WordPress.org

Support

Support » Plugins and Hacks » [Resolved] wp_get_attachment_image_src full image issues

[Resolved] wp_get_attachment_image_src full image issues

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeremy Herve
    Jetpack Mechanic

    @jeherve

    Could you give me a few examples of the returned Photon URLs?

    If you could give us a link to your site as well, that might be useful!

    Thanks.

    Sure, if you look in the <head> section of this page: http://www.controlcommandescape.com/games/borderlands-2/

    you’ll see

    <meta property="og:image" content="http://i2.wp.com/www.controlcommandescape.com/wp-content/uploads/2012/11/borderlands2.png?resize=1024%2C1024" />
    <meta property="og:image" content="http://i1.wp.com/www.controlcommandescape.com/wp-content/uploads/2012/11/2012-11-17_00002.jpg?resize=1920%2C1080" />

    and no dimensions are returned for either image

    Plugin Contributor Erick Hitter
    Code Wizard

    @ethitter

    Hello,

    The lack of width and height in the data returned by wp_get_attachment_image_src() is a necessary side-effect of using Photon.

    At present, Photon has no way of informing WordPress of the dimensions of an image it resizes. While there are many cases where the size of the image received from Photon matches the requested size, there are also cases when this won’t be true. This depends largely on the size of the original image and whether or not the image size dictates cropping be applied.

    As a result, the module sets WordPress’ image functions to return false when an image is processed with Photon. This avoids image skewing and prevents WordPress from returning misinformation about the resized image.

    Hope this helps explain what’s happening with wp_get_attachment_image_src().

    As for the resizing parameters on the og:image meta tag, that problem should’ve been fixed in Jetpack 2.2. We’ll investigate why that isn’t working properly and update this thread once it is fixed in Jetpack.

    ok thanks for the info. Is there a simple way to use wp_get_attachment_image_src() without using photon? I.e. I could use it once (without photon) to grab the image dimensions from the local full-size image, and then again (with photon) to actually grab the image url?

    Edit: Never mind, I see you’ve answered this on my other thread!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] wp_get_attachment_image_src full image issues’ is closed to new replies.