Michael Jones Posted June 1, 2006 Report Share Posted June 1, 2006 Hi... I've installed the Google Maps cemetery modification and had a question that I'm sure one of you can answer. This line in showmap.phpecho " var markerHTML = \"<div style='width:180px'><img src='headstones/thumbs/thumb_\";\n";calls up my thumbnail photo of a cemetery photo. However, it only works if I rename my thumb in the form of thumb_mycemeteryphoto.jpg --I have set my thumbs to be named as mycemeteryphoto_thumb.jpg. How do I change the code in img src=blah blah blah blah to make it get the image which has the _thumb as a suffix to the file name, rather than a prefix? (Seems like I need some kind of wildcard, but I don't know the syntax). Thanks in advance.Mike Quote Link to comment Share on other sites More sharing options...
steve30000 Posted June 1, 2006 Report Share Posted June 1, 2006 What are the lines of code around this one (5 before and 5 after)? I think there are different versions/hacks of the cemetery modification so it would help to see what else was around this one before telling you what to change and screwing everything up.I think it is an easy fix though once we see the rest of the code. Quote Link to comment Share on other sites More sharing options...
Michael Jones Posted June 1, 2006 Author Report Share Posted June 1, 2006 What are the lines of code around this one (5 before and 5 after)? I think there are different versions/hacks of the cemetery modification so it would help to see what else was around this one before telling you what to change and screwing everything up.I think it is an easy fix though once we see the rest of the code.Here's the end of the showmap.php file which I have:// The ShowMeTheMap function takes 3 parameters: Longitude, Latitude, and a filename for a truncated thumbnail // filename in the headstones folder. This is called in the notes text.// echo "function ShowMeTheMap(geoCenterLong, geoCenterLat, thumb)"; echo "{\n"; if ( $tqsi_google_map_api_key != "" ) { echo "if (GBrowserIsCompatible()) {\n"; echo " var map = new GMap(document.getElementById(\"map\"));\n"; echo " var point = new GPoint(geoCenterLong, geoCenterLat);\n"; echo " map.setMapType(G_HYBRID_TYPE);\n"; echo " map.centerAndZoom(point, 4);\n"; echo " var markerHTML = \"<div style='width:180px'><img src='headstones/thumbs/thumb_\";\n"; echo " markerHTML = markerHTML + thumb;\n"; echo " markerHTML = markerHTML + \"' style='float:left; border:1px solid #000033; margin-right:10px'><span class='normal'><b>$cemetery[cemname]</b></span></div>\";\n"; echo " map.addControl(new GLargeMapControl());\n"; echo " map.addControl(new GMapTypeControl());\n"; echo " map.openInfoWindowHtml(point, markerHTML);\n"; echo " GEvent.addListener(map, 'click', function(overlay, point) {\n"; echo " if (overlay) {\n"; echo " map.removeOverlay(overlay);\n"; echo " } else if (point) {\n"; echo " map.addOverlay(new GMarker(point));\n"; echo " }\n"; echo " });\n"; echo "}\n"; echo "else {\n"; echo "alert(\"Browser not compatible with Google Mapping Function.\");\n"; echo "}\n"; } else { echo "alert(\"No Google Map Site API Key Defined\");\n"; } echo "}\n"; echo "//]]>\n"; echo "</script>\n"; if( !$cms[support] ) { echo "</head>\n"; if( !$tngprint && !$flags[noheader] ) include( $customheader ); if ( $tngprint ) include( $tqsi_customprintheader); } if( !$flags[noicons] ) echo tng_icons( 1 );}?> Quote Link to comment Share on other sites More sharing options...
steve30000 Posted June 1, 2006 Report Share Posted June 1, 2006 Give this a try. I *think* it should work. It assumes the extension on the graphic is three characters.echo " map.centerAndZoom(point, 4);\n";// Begin revisions SHecho " var markerHTML = \"<div style='width:180px'><img src='headstones/thumbs/\";\n";echo " var thumbNew = thumb.substring(0,thumb.length-4) + "_thumb." + thumb.substring(3,0);\n";echo " markerHTML = markerHTML + thumbNew;\n";// End revisions SH echo " markerHTML = markerHTML + \"' style='float:left; border:1px solid #000033; margin-right:10px'><span class='normal'><b>$cemetery[cemname]</b></span></div>\";\n";echo " map.addControl(new GLargeMapControl());\n";echo " map.addControl(new GMapTypeControl());\n";echo " map.openInfoWindowHtml(point, markerHTML);\n"; Quote Link to comment Share on other sites More sharing options...
Michael Jones Posted June 2, 2006 Author Report Share Posted June 2, 2006 Give this a try. I *think* it should work. It assumes the extension on the graphic is three characters.echo " map.centerAndZoom(point, 4);\n";// Begin revisions SHecho " var markerHTML = \"<div style='width:180px'><img src='headstones/thumbs/\";\n";echo " var thumbNew = thumb.substring(0,thumb.length-4) + "_thumb." + thumb.substring(3,0);\n";echo " markerHTML = markerHTML + thumbNew;\n";// End revisions SH Steve, Thanks... I tried this, but I get the following error:Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/xxxxxxx/public_html/showmap.php on line 302Any ideas? Quote Link to comment Share on other sites More sharing options...
steve30000 Posted June 2, 2006 Report Share Posted June 2, 2006 Could be because I was stupid and didn't escape out the quotation marks which were inside other quotation marks. There should be a backslash before the quotes around _thumb.:echo " var thumbNew = thumb.substring(0,thumb.length-4) + \"_thumb.\" + thumb.substring(3,0);\n"; Quote Link to comment Share on other sites More sharing options...
Michael Jones Posted June 3, 2006 Author Report Share Posted June 3, 2006 Could be because I was stupid and didn't escape out the quotation marks which were inside other quotation marks. There should be a backslash before the quotes around _thumb.:echo " var thumbNew = thumb.substring(0,thumb.length-4) + \"_thumb.\" + thumb.substring(3,0);\n";Hmm... that still didn't work in calling up the thumbnail image on the Google Map. Just to recap, here's what I have. Code in showmap.php: echo " map.centerAndZoom(point, 4);\n"; echo " var markerHTML = \"<div style='width:180px'><img src='headstones/thumbs/\";\n"; echo " var thumbNew = thumb.substring(0,thumb.length-4) + \"_thumb.\" + thumb.substring(3,0);\n"; echo " markerHTML = markerHTML + thumbNew;\n"; echo " markerHTML = markerHTML + \"' style='float:left; border:1px solid #000033; margin-right:10px'><span class='normal'><b>$cemetery[cemname]</b></span></div>\";\n"; echo " map.addControl(new GLargeMapControl());\n"; echo " map.addControl(new GMapTypeControl());\n"; echo " map.openInfoWindowHtml(point, markerHTML);\n";My photo cited in the notes for the cemetery is called AlleghenyCemetery.jpg. It is located in my /headstones directory. Its thumbnail is called AlleghenyCemetery_thumb.jpg. It is located in my /headstones/thumbs directory. Any ideas on why it still doesn't work? Quote Link to comment Share on other sites More sharing options...
steve30000 Posted June 3, 2006 Report Share Posted June 3, 2006 Mike,Can you give a link to your website where you are using this? Maybe seeing the resulting source code on the webpage will help.Thanks. Quote Link to comment Share on other sites More sharing options...
Michael Jones Posted June 3, 2006 Author Report Share Posted June 3, 2006 Mike,Can you give a link to your website where you are using this? Maybe seeing the resulting source code on the webpage will help.Thanks.Steve, Sure, it's www.jonesgenealogy.netMikeSteve, Sure, it's www.jonesgenealogy.netMikeReplying to myself... is that like talking to myself? Anyway, the properties for the thumbnail say it's calling up image http://www.jonesgenealogy.net/headstones/t...etery_thumb.All --I'm guessing it should be _thumb.jpg but I'm not sure how to change this... Quote Link to comment Share on other sites More sharing options...
Michael Jones Posted June 4, 2006 Author Report Share Posted June 4, 2006 Steve, Thanks for your help... despite knowing basically nothing about php, I was able to get it working through some trial and error (I certainly have no clue what I'm doing!).I changed this line:echo " var thumbNew = thumb.substring(0,thumb.length-4) + "_thumb." + thumb.substring(3,0);\n";To this:echo " var thumbNew = thumb.substring(0,thumb.length-4) + \"_thumb.jpg\";\n";Now it works. Thanks! Quote Link to comment Share on other sites More sharing options...
steve30000 Posted June 4, 2006 Report Share Posted June 4, 2006 Cool. I was trying to have it determine the extension automatically just in case there were any other files besides jpgs... guess I could have just asked and saved some problems.Anyway, glad you got it working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.