getimagesize warnings
-
In the latest version of the Facebook Open Graph plugin I see php warnings related to the getimagesize php call. Here’s an example of another site that that uses the plugin and is generating these errors:
http://maschenpunk.de/strickdesign-von-maschenpunk/Maybe you can use wp_get_attachment_image_src in order to get the image size (rather than using wp_get_attachment_url followed by getimagesize) that would at least fix the error on line 490.
https://wordpress.org/plugins/wonderm00ns-simple-facebook-open-graph-tags/
-
I have the same problem as contemplate :
[03-Dec-2014 19:35:42 UTC] PHP Warning: getimagesize(/webstuff/xxxxxx/https://lh4.googleusercontent.com/-wZ2LWVaYdaw/UzQtWOEDAqI/AAAAAAAABcs/eyWlEPJVJ7s/Screenshot_2014-03-27-12-57-33.png?imgmax=1024) [function.getimagesize]: failed to open stream: No such file or directory in /webstuff/xxxxxx/wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 477
Then on line 477 we convert the url to path no matter if allow_url_fopen is set to 1 or not.
That doesn’t work for sites running in network mode when the image URLS are always things like:
http://blogs.canalplan.org.uk/steve/files/2014/08/stupid-spammers.pngbut at a file system level its actually
/wp-root/wp-content/blogs.dir/3/files/2014/08/stupid-spammers.pngwhich means you get:
[03-Dec-2014 19:05:47 UTC] PHP Warning: getimagesize(/webstuff/xxxxxx/files/2014/08/stupid-spammers.png) [function.getimagesize]: failed to open stream: No such file or directory in /webstuff/xxxxxx/wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 477
OK! We’ll take a look.
contemplate: 1.3.4 should fix this. Thanks!
Steve: if you have allow_url_fopen=1 this should also fix it for you. If you don’t, probably the local method is still not working.
Please both of you do get back to us on this.
With version 1.3.4 the warnings are back again. You can see them here.
(comment removed – wrong user)
That “line 472” is weird. On 1.3.4 line 472 is a comment.
Have you changed anything on the plugin?
Also the error you’re seeing is “HTTP request failed! HTTP/1.1 403 Forbidden” which means your server is denying it’s own IP to access URLs on it. That’s not a very common configuration. You have allow_url_fopen=1 so that should work.
Anyway, can you please try this?
https://meocloud.pt/link/1240a4c9-8fdb-4be3-8409-71420a23a16a/wonderm00n-open-graph.zip/Steve,
Just tested network mode and for a URL like:
http://lab.webdados.pt/multi/outro/wp-content/uploads/sites/2/2014/12/Capture-300×189.jpgI get this full path:
/home/account_username/public_html/multi/wp-content/uploads/sites/2/2014/12/Capture-300×189.jpg“multi” is the folder where I’ve installed network wordpress and /multi/outro/ is the URL I chose for this specific website.
So
ABSPATH.str_replace(trailingslashit(site_url()), '', $imagetemp);is working rather nice here. Can you please explain how do you have things set up so that we can make this work for that configuration too?It was getting the error on line 497 (not line 472). I installed the new version of the script and it’s working again.
Thanks,
JonOk I upgraded to 1.3.4 and it works. However when I activated it the plugin it gave this error at the top of the plugins dashboard:
The plugin generated 217 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
joneisman: I still think this is a very strange issue. If you have allow_url_fopen=1 it should work.
I’m working on a solution that consists on a special advanced setting to use “local mode” on these cases. This could solve your problem and still be able to use url mode for cases like Steve’s (who I’m waiting for a reply).
Try this again: https://meocloud.pt/link/1240a4c9-8fdb-4be3-8409-71420a23a16a/wonderm00n-open-graph.zip/
You now have to replace both wonderm00n-open-graph.php and includes/settings-page.php
Your website will still show the warning. Then you go to settings and activate “Force getimagesize on local file even if allow_url_fopen=1”. The warning should now go away and the image correctly used.Can you confirm?
Steve: You should download the same file but NOT activate “Force getimagesize on local file even if allow_url_fopen=1”. Is this also working for you?
contemplate: Can you also try this new version from the url above and NOT activate “Force getimagesize on local file even if allow_url_fopen=1” to see if everything works ok with your Flickr images?
I’ll take a look at that “unexpected output” thing then.I will not update the plugin again until I hear from all of you.
I’ve fixed the “unexpected output” error.
The zip file is updated.
I just installed the latest version that you sent out 2 minutes ago. It does fix the problem (after setting the new option). However, it looks like it’s generated unexpected output (probably for debugging). It’s printing the following at the top of the page:
/home2/jeiseman/public_html/classical-scene/wp-content/uploads/2012/07/wilkins-betterw-201×300.jpg
Yes. It was debug information. Just delete or comment line 510 and keep that version until I release an update.
ZIP updated without that line.
Steve, contemplate: all good on your side? Does it work correctly for you guys? Can I move on and update the plugin?
I’m good with this new version. It works fine for me.
Thanks,
Jon
The topic ‘getimagesize warnings’ is closed to new replies.