Page 1 of 1

CGGoogleMaps "Error reading image" problem

Posted: Fri Apr 03, 2009 11:02 am
by Charles Butcher
CGGoogleMaps 1.4 produces this error:

GoogleMapAPI:createMarkerIcon: Error reading image: http://stanhoe.org/modules/CGGoogleMaps ... dd-end.png

which seems odd, because that path is perfectly fine as far as I can see. dd-end.png is set as my default icon.

Any ideas? I have CGExtensions 1.15.2 and CGSimpleSmarty 1.4.1, and I'm not using custom icons. Things I've tried without success:

* debug mode just gives the same message
* setting all module permissions to 777
* turning off all the optional settings in CGGoogleMaps
* setting a different icon as the default -- the error message just changes to reflect this
* changing the path to the icon -- ditto

Re: CGGoogleMaps

Posted: Fri Apr 03, 2009 9:10 pm
by andershz
I had the same problem.
It started when I upgraded CGGoogleMaps module to Version 1.2,
or possibly but not likely with the upgrade of CMS Made Simple to version 1.5.3,
or one of the other upgrades I did at the same time.
Before that it worked, (I have a single map with a single marker, so it's fairly easy to notice when it stops working).

A bit of googling led me to this:
http://phpinsider.com/smarty-forum/viewtopic.php?t=14489&sid=adecd85bb1fbddbd3e846ad0dd93948d

The CGGoogleMaps module uses Smarty's GoogleMapAPI under the hood, and it looks like that API does not
like when the icon is specified as an URL, (http://...). Instead it prefers a file path.
I don't know if CGGoogleMaps 1.2 includes a new version GoogleMapAPI with this limitation,
or if it's CGGoogleMaps that has changed the way it passes parameters to GoogleMapAPI.

Now it turns out that, (at least in my case), it does work even when the icon is specified as an URL
if the setting allow_fopen_url=on in php.ini.

If you can't (or don't want to) enable allow_fopen_url you can modify the code.
I made this hack around line 790 in modules/CGGoogleMaps/lib/GoogleMapAPI-2.4/GoogleMapAPI.class.php.

From:

Code: Select all

--- removed --
To:

Code: Select all

--- removed --
That worked for me.

Re: CGGoogleMaps "Error reading image" problem

Posted: Sat Apr 04, 2009 9:41 am
by Charles Butcher
CGGoogleMaps 1.4 still includes GoogleMapAPI-2.4, and your hack has worked for me. Thank you very much!

Re: CGGoogleMaps "Error reading image" problem

Posted: Sat Apr 04, 2009 11:06 am
by andershz
Glad to be of service...
But CGGoogleMaps 1.4?  Are you sure?  I can't find any version newer than 1.2.

Re: CGGoogleMaps "Error reading image" problem

Posted: Mon Apr 06, 2009 9:07 am
by Charles Butcher
Apologies! It is of course v1.2.

Re: CGGoogleMaps "Error reading image" problem

Posted: Fri Jun 26, 2009 2:33 pm
by cb2004
This fix worked for me as well.

Re: CGGoogleMaps "Error reading image" problem

Posted: Sun Jul 12, 2009 6:01 pm
by gjr
Same problem here, i will give the fix a try!

Re: CGGoogleMaps "Error reading image" problem

Posted: Sun Jul 12, 2009 10:20 pm
by olavt
I have the same problem. I have upgraded to newest version of CMSMS, CGGoogleMaps, CGExenstions and CGSmarty. I hoped this would solve the problem, but it did not.

The bug also messes up all non-ASCII carachters on the pages.

As I am not a programmer, I am reluctant to try the hack mentioned.

Re: CGGoogleMaps "Error reading image" problem

Posted: Fri Jul 24, 2009 3:06 pm
by Stom
I see this error is still present in 1.4. I've tried the fix but it has no effect. Bugger :(

Re: CGGoogleMaps "Error reading image" problem

Posted: Fri Sep 04, 2009 11:34 am
by nicmare
had same problems but the fix works for me!

Re: CGGoogleMaps "Error reading image" problem

Posted: Tue Oct 06, 2009 4:51 pm
by MarkFresh
The hack works for metoo, thanks


If it helps for a fix my page was saying:
GoogleMapAPI:createMarkerIcon: Error reading image: http://www.domain.co.uk/modules/CGGoogl ... /hotel.png

The error log said:
File does not exist: /path-to/public_html/hotel, referer: http://www.domain.co.uk/admin/moduleint ... 1_map_id=1

Re: CGGoogleMaps "Error reading image" problem

Posted: Wed Jun 16, 2010 8:17 pm
by MantaPro
Many thanks to andershz for isolating the problem and providing a fix. In my case I tried it but still had a problem. After a bit more investigation, it may be caused by my hosting company. The suggested solution asssembles a path by assembling a suffix onto the DOCUMENT_ROOT root by taking the portion of the image icons URL that is to the right of SERVER_NAME. In my hosting company's environment the image icon path is http://www.domain etc but the SERVER_NAME is domain . com (i.e. the www. is missing).  andershz solution takes the server name + 7 characters to allow for "http://". I know hosting companies can be a bit inconsitent with their installation of Apache, etc so this may be the cause of other people finding andershz code doesn't fix their installation. So if that fix does not work, try this

Code: Select all

...code change removed...
Basically the same, except it calculates the portion of the image icon url to use rather than assuming 7.

Try it - good luck

Re: CGGoogleMaps "Error reading image" problem

Posted: Wed Aug 25, 2010 10:12 am
by merriman
The hack worked for me - many thanks

Re: CGGoogleMaps "Error reading image" problem

Posted: Wed Sep 15, 2010 11:02 pm
by mr.bacan
I'm using CMSMS 1.8.2 and the hack worked like a charm. Thanks a lot.

Re: CGGoogleMaps

Posted: Mon Mar 07, 2011 8:25 pm
by Sakrow
Thank you very much.

You saved me!

Do you know when you fix this problem without having to do such things?

* Translated with Google *