WordPress.org

Forums

Jetpack by WordPress.com
[resolved] Photon resizing images incorrectly in IE8 (3 posts)

  1. lindseybugbee
    Member
    Posted 2 years ago #

    Hi,

    I activated Jetpack's Photon, v2.2, and I'm having issues with how images are displayed in IE8. When Photon is activated, images are displayed with a width and height value of 1px, so basically they can't be seen. My code in my custom theme for getting the featured images is:

    function get_featured_image($post_id, $size, $class, $title)
    {
    if($class == NULL) { $class = 'wp-featured-image'; } else { $class = $class . ' wp-featured-image'; }
    if($post_id == NULL) { $post_id = get_post_thumbnail_id(); }
    $wp_featured_image = wp_get_attachment_image_src($post_id, $size, true);

    $src = $wp_featured_image[0];
    $width = $wp_featured_image[1];
    $height = $wp_featured_image[2];

    $output = '<img width="'.$width.'" height="'.$height.'" src="'.$src.'" class="'.$class.'" alt="'.$title.'" title="'.$title.'" />';

    return $output;
    }

    Any ideas or suggestion on how to fix this issue are welcome!

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

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 2 years ago #

    As mentioned in this thread, the lack of width and height in the data returned by wp_get_attachment_image_src() is a necessary side-effect of using Photon.

    You can overwrite the default Photon settings by following the instructions here:
    http://wordpress.org/support/topic/wp_get_attachment_image_src-changed?replies=5#post-3842573

  3. lindseybugbee
    Member
    Posted 2 years ago #

    A solution in my case was to simply remove the width and height attributes from the img tag.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic