CGGoogleMaps "Error reading image" problem
- Charles Butcher
- Forum Members
- Posts: 103
- Joined: Sat Jul 05, 2008 8:25 pm
CGGoogleMaps "Error reading image" problem
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
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
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:
To:
That worked for me.
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 --
Code: Select all
--- removed --
Last edited by andershz on Mon Nov 23, 2009 9:01 pm, edited 1 time in total.
- Charles Butcher
- Forum Members
- Posts: 103
- Joined: Sat Jul 05, 2008 8:25 pm
Re: CGGoogleMaps "Error reading image" problem
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
Glad to be of service...
But CGGoogleMaps 1.4? Are you sure? I can't find any version newer than 1.2.
But CGGoogleMaps 1.4? Are you sure? I can't find any version newer than 1.2.
- Charles Butcher
- Forum Members
- Posts: 103
- Joined: Sat Jul 05, 2008 8:25 pm
Re: CGGoogleMaps "Error reading image" problem
Apologies! It is of course v1.2.
Re: CGGoogleMaps "Error reading image" problem
This fix worked for me as well.
Re: CGGoogleMaps "Error reading image" problem
Same problem here, i will give the fix a try!
Re: CGGoogleMaps "Error reading image" problem
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.
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
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
had same problems but the fix works for me!
Re: CGGoogleMaps "Error reading image" problem
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
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
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
Basically the same, except it calculates the portion of the image icon url to use rather than assuming 7.
Try it - good luck
Code: Select all
...code change removed...
Try it - good luck
Last edited by calguy1000 on Tue Dec 07, 2010 4:36 pm, edited 1 time in total.
Re: CGGoogleMaps "Error reading image" problem
I'm using CMSMS 1.8.2 and the hack worked like a charm. Thanks a lot.
Re: CGGoogleMaps
Thank you very much.
You saved me!
Do you know when you fix this problem without having to do such things?
* Translated with Google *
You saved me!
Do you know when you fix this problem without having to do such things?
* Translated with Google *