Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

GoogleMapAPI:createMarkerIcon: Error reading image

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
fahiemoto
Smarty n00b


Joined: 18 Nov 2008
Posts: 4

PostPosted: Tue Nov 18, 2008 9:48 am    Post subject: GoogleMapAPI:createMarkerIcon: Error reading image Reply with quote

I have a problem showing a custom icon in the GoogleMap API.

i get the error message:GoogleMapAPI:createMarkerIcon: Error reading image: logo.png.

i did the following: i added the following line in the file:

$map->setMarkerIcon('logo.png','logo.png',0,0,10,10);


I anyone can explain to me how to intergrate a custom icon i would be realy happy!

this is the file:

<?php
require('GoogleMap/GoogleMapAPI.class.php');

$map = new GoogleMapAPI('map');
// setup database for geocode caching
$map->setDSN('mysql://*****:******@localhost/*****');





// enter YOUR Google Map Key
$map->setAPIKey('YOURGOOGLEMAPKEY');

// create some map markers
$map->addMarkerByAddress('koningstraat 277 den haag','Fahiemoto','<b>Fahiemoto</b>');
$map->addMarkerByAddress('koningstraat 300 den haag','Raies','<b>Raies</b>');
$map->addMarkerByAddress('Koningin Wilhelminaplein 1 den haag','<b>Showroom</b>');
$map->addMarkerByAddress('Rijswijkseweg 622 den haag',"Hoofdkantoor","<b>Hoofdkantoor</b>");
$map->setMarkerIcon('logo.png','logo.png',0,0,10,10);



?>


Last edited by fahiemoto on Thu Nov 20, 2008 11:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Tue Nov 18, 2008 3:43 pm    Post subject: Reply with quote

Use the full path to the icon, relative to doc root. Start with a slash /. See the example in the docs.
Back to top
View user's profile Send private message Visit poster's website
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Tue Dec 23, 2008 2:56 pm    Post subject: Reply with quote

Same problem but with full path:
GoogleMapAPI:createMarkerIcon: Error reading image: [..]
( i can post URL)
I'm not solo...(Type this error in google)


thanks in advance,
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 23, 2008 4:43 pm    Post subject: Reply with quote

Does $_SERVER['DOCUMENT_ROOT'] have a value in your PHP script? It relies on that to be set to your doc root to find the image.
Back to top
View user's profile Send private message Visit poster's website
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Wed Dec 24, 2008 8:42 am    Post subject: Reply with quote

Yes something like:
/data/www/[...]
Back to top
View user's profile Send private message
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Wed Dec 24, 2008 8:48 am    Post subject: Reply with quote

A example (like me)
http://www.20minutes.fr/vin/
Back to top
View user's profile Send private message
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Wed Dec 24, 2008 2:22 pm    Post subject: Reply with quote

yes...
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 24, 2008 2:25 pm    Post subject: Reply with quote

My guess is that getimagesize() does not like a URL path. Try using a local system filepath (relative to doc root.)
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 24, 2008 2:26 pm    Post subject: Reply with quote

Syruis wrote:
A example (like me)
http://www.20minutes.fr/vin/


Try using /vin/gmap/Bonsplans.png as the filepath.
Back to top
View user's profile Send private message Visit poster's website
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Wed Dec 24, 2008 2:44 pm    Post subject: Reply with quote

Hello,

i have tested with a locale path and it works fine, but it will be nice if it works with "http" localisation ( and https )...
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 24, 2008 5:59 pm    Post subject: Reply with quote

getimagesize() does not like URLs. Use the same path as you would use inside an <img src=""> tag. It is that way on purpose so you don't need to think about system paths. I suppose it could internally chop off the host, but I think using the relative path in the first place is a better choice.

Last edited by mohrt on Thu Dec 25, 2008 3:24 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Syruis
Smarty Rookie


Joined: 09 Dec 2008
Posts: 7

PostPosted: Wed Dec 24, 2008 6:32 pm    Post subject: Reply with quote

Ok...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP