WordPress.org

Ready to get started?Download WordPress

Forums

PB Responsive Images
Featured image (4 posts)

  1. Johan Edlund
    Member
    Posted 1 year ago #

    This plugin works great for images in the body but unfortunately I can't get the featured image(s) to work. Any suggestions?

    http://wordpress.org/extend/plugins/pb-responsive-images/

  2. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    What code are you using in your theme to display the featured image? If you post that, I can offer some suggestions.

  3. Johan Edlund
    Member
    Posted 1 year ago #

    Hi Jacob and thanks for your quick reply.

    I'm currently using 2012 but I've also tried 2011. Here's a test page: http://edlunddesign.com/hej-varlden/ PB works fine for the image in the body but not for the featured image.

    I have added the path http://mydomain.com/wp-content/plugins/pb-responsive-images/slir/ for SLIR but I guess that mod_rewrite is working like it should..? At least in the .htaccess I see:
    RewriteRule ^wp-content/plugins/pb-responsive-images/slir/(.*)$ /wp-content/plugins/pb-responsive-images/slir/index.php?r=$1 [QSA,L]

  4. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    Johan,

    While this plugin tries to make things easier, it doesn't automatically take care of image responsiveness throughout a theme - that's still in the hands of the theme author. As such, this is still very much a developer oriented plugin, rather than user oriented. When I was asking for the code you're using, I was referring to the php you're using to insert the image, not the site or theme name.

    However, as you're using the 2012 template, I can make some assumptions - you're likely referring to the 'the_post_thumbnail' function call on line 18 of content.php. If so, you'd probably want to replace that code with something like this:

    $image = get_the_post_thumbnail();
    
    $formats = array(
       array("media"=>"" ,"query"=>"w368","fallback"=>true),
       array("media"=>"(min-device-pixel-ratio:2)" ,"query"=>"w736",),
       array("media"=>"(min-width:420px)" ,"query"=>"w833",),
       array("media"=>"(min-width:420px) and (min-device-pixel-ratio:2)" ,"query"=>"w1000",),
       array("media"=>"(min-width:885px)","query"=>"w1000"),
    );
    
    echo RIP::get_picture($image,$formats);

    The sizes above are probably incorrect, I just pasted the code from the help tab on the plugin page. You'll have to figure out what sizes you'd like to use in relation to that image in your theme, and do the same for any other images inserted outside of anything not filtered via 'the_content'. It's not an easy solution, but it's the cleanest comprehensive solution I have come up with for this very sticky problem.

    Hope that helps!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic