Support » Plugin: Jetpack by WordPress.com » Jetpack (Photon) breaks core function wp_get_attachment_image_src

  • Resolved dgrundel

    (@dgrundel)


    In the latest version of Jetpack, wp_get_attachment_image_src() returns empty values for width and height with Photon enabled.

    Disabling Photon fixes the issue at the cost of losing the performance benefits of the Photon service. I have seen this behavior on multiple sites I maintain.

    I can’t begin to express how frustrating it is that a plugin (especially by Automattic!) would break a core function in this way.

    My solution was to change my code to use PHP’s getimagesize() function to get the proper values (which is what the core function should be doing anyway.)

    $image_src = wp_get_attachment_image_src($post_thumbnail_id);
    $image_url = $image_src[0];
    @list($image_w, $image_h) = getimagesize($image_url);

    Is there a better solution?

    http://wordpress.org/extend/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Jetpack (Photon) breaks core function wp_get_attachment_image_src’ is closed to new replies.