Implemented Server Error-Logs - getimagesize opengraph.php on line 223

More
4 years 6 months ago - 4 years 6 months ago #1018 by H. Goedecke
Hi,

if i check my Server Error-Logs, i find many messages like this:
PHP Warning: getimagesize(... - my path- ... /flagge%20grossbritannien.jpg): failed to open stream: No such file or directory in /... - my path- .../plugins/content/ochopengraph/helpers/opengraph.php on line 223

what´s the problem? It may be related to the file name of the images, for example blank characters in the file name? all files are available ...

Greetings!

DONLOADLINK to TEST version
This message contains confidential information
Last edit: 4 years 6 months ago by Ruud van Lent. Reason: Added downloadlink to test version
The topic has been locked.
More
4 years 6 months ago #1019 by Ruud van Lent
Hi,

this is definitely related to the image name having spaces.
You should never use file names with spaces as it can lead to issues: e.g. the JCE editor automatically makes filenames 'safe' when uploading an image (remove spaces).
Also Facebook and probably other Social media platforms will not take that image as the image to display.

For an other customer i had worked around this by making the image name safe by replacing the space with a %20. This will then work again for facebook, but the php method getimagesize will not find the image as 'ab%20cd.jpg' is not the same as 'ab cd.jpg'

I need to test if the php method getimagesize will handle correctly spaces. If not, then I need to workaround the warning. If it does, then i need to workaround the %20 / spaces.

Best thing though to avoid this and other issues (that are bound to happen) is to NOT use spaces in image names.

I will report back here if I have done some testing.

regards,
Ruud.
The topic has been locked.
More
4 years 6 months ago #1020 by H. Goedecke
Hi Ruud,

thx. I teach my clients to use secure filenames.

Greetings from Berlin!
The topic has been locked.
More
4 years 6 months ago - 4 years 6 months ago #1021 by Ruud van Lent
Hi,

that is always good :)

in the meantime I have added a link to a test version in the first post in this thread. This version will NOT give the warning in the logs / on screen when displaying errors is on.

It was more then a warning, because the file could not be found, the validation also didn't take place and so the og:image:width|height wasn't set as metatag.

It will now check for the warning and when encountered it will retry the validation with the 'urldecoded' filename (%20 will be space).

If that fails, then there is another issue that needs to be fixed.
Last edit: 4 years 6 months ago by Ruud van Lent.
The topic has been locked.