CGGoogleMaps "Error reading image" problem

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm

CGGoogleMaps "Error reading image" problem

Post 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
andershz
Forum Members
Forum Members
Posts: 49
Joined: Fri Nov 21, 2008 9:30 pm

Re: CGGoogleMaps

Post 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.
Last edited by andershz on Mon Nov 23, 2009 9:01 pm, edited 1 time in total.
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm

Re: CGGoogleMaps "Error reading image" problem

Post by Charles Butcher »

CGGoogleMaps 1.4 still includes GoogleMapAPI-2.4, and your hack has worked for me. Thank you very much!
andershz
Forum Members
Forum Members
Posts: 49
Joined: Fri Nov 21, 2008 9:30 pm

Re: CGGoogleMaps "Error reading image" problem

Post by andershz »

Glad to be of service...
But CGGoogleMaps 1.4?  Are you sure?  I can't find any version newer than 1.2.
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm

Re: CGGoogleMaps "Error reading image" problem

Post by Charles Butcher »

Apologies! It is of course v1.2.
cb2004
Power Poster
Power Poster
Posts: 317
Joined: Wed Jul 04, 2007 3:39 pm

Re: CGGoogleMaps "Error reading image" problem

Post by cb2004 »

This fix worked for me as well.
gjr
Forum Members
Forum Members
Posts: 42
Joined: Wed Jun 11, 2008 11:21 am

Re: CGGoogleMaps "Error reading image" problem

Post by gjr »

Same problem here, i will give the fix a try!
olavt

Re: CGGoogleMaps "Error reading image" problem

Post 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.
Stom
Forum Members
Forum Members
Posts: 82
Joined: Tue Jul 31, 2007 1:41 am

Re: CGGoogleMaps "Error reading image" problem

Post by Stom »

I see this error is still present in 1.4. I've tried the fix but it has no effect. Bugger :(
nicmare
Power Poster
Power Poster
Posts: 1150
Joined: Sat Aug 25, 2007 9:55 am

Re: CGGoogleMaps "Error reading image" problem

Post by nicmare »

had same problems but the fix works for me!
MarkFresh

Re: CGGoogleMaps "Error reading image" problem

Post 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
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: CGGoogleMaps "Error reading image" problem

Post 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
Last edited by calguy1000 on Tue Dec 07, 2010 4:36 pm, edited 1 time in total.
merriman

Re: CGGoogleMaps "Error reading image" problem

Post by merriman »

The hack worked for me - many thanks
mr.bacan

Re: CGGoogleMaps "Error reading image" problem

Post by mr.bacan »

I'm using CMSMS 1.8.2 and the hack worked like a charm. Thanks a lot.
Sakrow
Forum Members
Forum Members
Posts: 23
Joined: Wed Jun 23, 2010 7:05 pm

Re: CGGoogleMaps

Post 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 *
Locked

Return to “Modules/Add-Ons”