I’m pretty sure the problem is that hot-linking protection. We must add the proper HTTP REFERER.
Please try to add:
curl_setopt($ch, CURLOPT_REFERER, 'http://www.yourdomain.com');
after
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
and get back to me.
Adding the following does fix the problem:
curl_setopt($ch, CURLOPT_REFERER, ‘http://www.ourfamilybios.com’);
Although I’m not sure why this fixes the problem. I don’t have any hotlink protection in the .htaccess file and if I did you wouldn’t be able to directly link to the images. You can see that linking directly to the images does work by clicking on this link:
http://ourfamilybios.com/classical-scene/wp-content/uploads/2012/07/wilkins-betterw-201×300.jpg
I can assure you that are some situations in which I get a hostgator 403 page when opening the image direct link. Look, same URL at different browsers: http://snag.gy/nfSBo.jpg
Maybe this is some kind of hostgator protection that “goes away” after the user visited the website pages with that image on it.
I guess I’ll just add a HTTP REFERER to curl. It won’t warm anyone…
Once I add the HTTP REFERRER to curl it solves the problem and I no longer need to set the new option (Force getimagesize on local file even if allow_url_fopen=1).
Here’s what I added (after line 607):
curl_setopt($curl, CURLOPT_REFERER, 'http://'.$_SERVER['HTTP_HOST']);
I’m still getting the following warning:
[12-Dec-2014 14:10:25 UTC] PHP Warning: getimagesize(/wp-content/uploads/2009/12/examp1.jpg): failed to open stream: No such file or directory in /home3/nolisome/public_html/wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 647
It looks like it sometimes doesn’t pass the full path to getimagesize (it should have added /home3/nolisome/public_html to the front of the path). Note that this warning would be on line 646 on your version.
I just downloaded the latest version of the plugin (Version 1.5) and I’m still getting this warning:
[16-Dec-2014 02:32:19 UTC] PHP Warning: getimagesize(/wp-content/uploads/2008/11/strav.jpg): failed to open stream: No such file or directory in /home3/nolisome/public_html/wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 674
However, I can use the url to access this image:
http://www.classical-scene.com/wp-content/uploads/2008/11/strav.jpg
It looks like it’s still not prepending /home3/nolisome/public_html to the path.
If I check the new option (Force getimagesize on local file even if allow_url_fopen=1) it seems to fix the problem. But I thought that option shouldn’t really be needed anymore.
joneiseman: can you send me your email to marcoalmeida@webdados.pt ?
Its now working but throwing another “warning”
[16-Dec-2014 10:48:34 UTC] PHP Warning: imagesx() expects parameter 1 to be resource, boolean given in /xx/yyy/wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 610
Steve: please install the latest version.