Title: getimagesize warnings
Last modified: August 22, 2016

---

# getimagesize warnings

 *  Resolved [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/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/](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/](https://wordpress.org/plugins/wonderm00ns-simple-facebook-open-graph-tags/)

Viewing 15 replies - 1 through 15 (of 55 total)

1 [2](https://wordpress.org/support/topic/getimagesize-warnings/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/getimagesize-warnings/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/getimagesize-warnings/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/getimagesize-warnings/page/2/?output_format=md)

 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531224)
 * I there,
 * This is due to your server having URL file-acess disabled.
 * Can you download this [https://meocloud.pt/link/566d1786-bf3a-4e57-af45-2e1781128ea8/wonderm00n-open-graph.zip/](https://meocloud.pt/link/566d1786-bf3a-4e57-af45-2e1781128ea8/wonderm00n-open-graph.zip/)
   override wonderm00n-open-graph.php and get back to me?
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531227)
 * I tried that new version but I still see the errors. You can look [here](http://ourfamilybios.com/classical-scene/2014/07/14/blo-by-the-river/)
   to see my web page which uses this new version of the script and shows the errors.
   It looks like allow_url_fopen is set to 1 on my server. I tried forcing the full
   path name instead of the url and that fails as well although in that case it 
   fails with the following warning:
 * > Warning: getimagesize(/home2/jeiseman/public_html/wp-content/uploads/2012/07/
   > wilkins-betterw-201×300.jpg): failed to open stream: No such file or directory
   > in /home2/jeiseman/public_html/classical-scene/wp-content/plugins/wonderm00ns-
   > simple-facebook-open-graph-tags/wonderm00n-open-graph.php on line 465
 * You can go [here](http://ourfamilybios.com/classical-scene/wp-content/uploads/2012/07/wilkins-betterw-201x300.jpg)
   to see the image is available.
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531250)
 * You need to replace $_SERVER[‘DOCUMENT_ROOT’] with ABSPATH. THe difference is
   that ABSPATH is the path to the WordPress installation while $_SERVER[‘DOCUMENT_ROOT’]
   is the path to the root of the website. Here’s the new version that works:
    [https://dl.dropboxusercontent.com/u/28883337/wonderm00n-open-graph.zip](https://dl.dropboxusercontent.com/u/28883337/wonderm00n-open-graph.zip)
 * It always uses the path and not the url.
 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531259)
 * “You need to replace $_SERVER[‘DOCUMENT_ROOT’] with ABSPATH”
    You’re totally 
   right.
 * Can you try this one? [https://meocloud.pt/link/47da787d-21c6-4f45-8cd2-b24c2cb9195e/wonderm00n-open-graph.zip/](https://meocloud.pt/link/47da787d-21c6-4f45-8cd2-b24c2cb9195e/wonderm00n-open-graph.zip/)
 * I want to make sure I do keep the “allow_url_fopen” check because of possible
   external images being used
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531261)
 * The allow_url_fopen is set to 1 but the getimagesize using the url is still failing.
   Only convert from a url to a path if it contains the site_url. If it’s a pathname
   then prepend the ABSPATH.
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531262)
 * Disregard my last post. The new version does work. Thanks!
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531265)
 * It still fails using the latest version. You can see the error [here](http://ourfamilybios.com/classical-scene/2014/07/14/blo-by-the-river/).
   
   The problem is that allow_url_fopen is set to 1 but the getimagesize using the
   url is failing.
 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531266)
 * Try this one: [https://meocloud.pt/link/20104182-f6d0-45f9-ad51-97ca220fb7f6/wonderm00n-open-graph.zip/](https://meocloud.pt/link/20104182-f6d0-45f9-ad51-97ca220fb7f6/wonderm00n-open-graph.zip/)
 * I’m adding the site_url above if the path does not contain it and then remove
   it again just when performing get_image_size.
 * This way I’ll always get the full URL to use in the OG tag and always use local
   file path to test the image size.
 * Anyway: if you have allow_url_fopen set to 1 it should work… but this new approach
   I’m now using should do it.
 * Please get back to me.
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531269)
 * Here’s a new version of the script that works:
    [https://dl.dropboxusercontent.com/u/28883337/new/wonderm00n-open-graph.zip](https://dl.dropboxusercontent.com/u/28883337/new/wonderm00n-open-graph.zip)
 * It only replaces the url with a path if it’s not an external script.
 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531271)
 * joneiseman,
 * You already sent me that version.
 * You did not, however, told me if the last one I sent is working for you. (it 
   should be)
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531276)
 * No the new version didn’t work. It doesn’t convert the internal urls to paths
   because allow_url_fopen is set to 1.
 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531279)
 * I don’t think you have the last version.
    This is it: [https://meocloud.pt/link/20104182-f6d0-45f9-ad51-97ca220fb7f6/wonderm00n-open-graph.zip/](https://meocloud.pt/link/20104182-f6d0-45f9-ad51-97ca220fb7f6/wonderm00n-open-graph.zip/)
 * In the last one we add the site_url on line 470 if it doesn’t has it already.
   So now all images should have the full URL.
 * Then on line 477 we convert the url to path no matter if allow_url_fopen is set
   to 1 or not.
 * It should work for everyone.
 *  Thread Starter [joneiseman](https://wordpress.org/support/users/joneiseman/)
 * (@joneiseman)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531288)
 * I put in the new version and it works!
    Thank you.
 *  [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * (@webdados)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531289)
 * OK, I’ll push an update then.
 *  [contemplate](https://wordpress.org/support/users/contemplate/)
 * (@contemplate)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/#post-5531354)
 * Sorry but I’m having the same error even after updating to 1.3.3 and attempting
   to use your file. We use flickr images on our blog and it’s trying to find them
   locally. I’ve deactivated the plugin for now. Here is an example warning:
 * Warning: getimagesize(/home/username/public_html/http://farm6.staticflickr.com/
   5489/11224964104_df2698c696_z.jpg): failed to open stream: No such file or directory
   in /home/username/public_html/wp-content/plugins/wonderm00ns-simple-facebook-
   open-graph-tags/wonderm00n-open-graph.php on line 477
 * Note: I made the username of the filepath generic on purpose.

Viewing 15 replies - 1 through 15 (of 55 total)

1 [2](https://wordpress.org/support/topic/getimagesize-warnings/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/getimagesize-warnings/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/getimagesize-warnings/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/getimagesize-warnings/page/2/?output_format=md)

The topic ‘getimagesize warnings’ is closed to new replies.

 * ![](https://ps.w.org/wonderm00ns-simple-facebook-open-graph-tags/assets/icon-
   256x256.gif?rev=2891184)
 * [Open Graph and Twitter Card Tags](https://wordpress.org/plugins/wonderm00ns-simple-facebook-open-graph-tags/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wonderm00ns-simple-facebook-open-graph-tags/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wonderm00ns-simple-facebook-open-graph-tags/)
 * [Active Topics](https://wordpress.org/support/plugin/wonderm00ns-simple-facebook-open-graph-tags/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wonderm00ns-simple-facebook-open-graph-tags/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wonderm00ns-simple-facebook-open-graph-tags/reviews/)

 * 55 replies
 * 6 participants
 * Last reply from: [Marco Almeida | Webdados](https://wordpress.org/support/users/webdados/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/getimagesize-warnings/page/4/#post-5531464)
 * Status: resolved