• A few minor code fixes that I put in to make it work with no errors that I thought I would share back here. They may not be an issue for everyone but I was getting errors.

    in responsive-image-polyfill.php from line 357, change the if statement to check if $format->fallback exists rather than just looking for a truthy value to stop the undefined value error:

    // Add the fallback, if requested
    if($format->fallback)

    becomes:

    // Add the fallback, if requested
    if(isset($format->fallback))

    This one was odd though because it only happened on some installs – still, can’t hurt.

    line 64 of config.php I got a deprecated function warning on
    $value = mysql_escape_string($value);
    so updated it to:
    $value = mysql_real_escape_string($value);

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter marblegravy

    (@marblegravy)

    Another minor one. I was getting an undefined index warning when trying to pass the post thumbnail through get_picture():

    RIP::get_picture(the_post_thumbnail());

    line 302 of responsive-image-polyfill.php:

    if(!$image->attributes['src']) return $image;
    becomes
    if(!isset($image->attributes['src'])) return $image;

    I assume this is the correct behaviour – that if there is no source, just pass the $image var on?

    Plugin Author Jacob Dunn

    (@spacemanspud)

    Hey Marblegravy,

    Thanks for the heads up on the errors – I’ll get these patched in, it’s always nice having the fix along with the error report. As far as the last issue, it’s related to your other thread, in that the_post_thumbnail() doesn’t return a string for the plugin to work with, leaving it with the src undefined. I’ll add a sanity check in to just return nothing if it’s passed nothing (or probably better, throw an error, if in WP_DEBUG mode), but hopefully you’ll be able to resolve the separate issue there.

    Thanks!

    Thread Starter marblegravy

    (@marblegravy)

    With the fallback image – I got my fix wrong. With my fix, it sets a fallback image as every image because it was only testing to see if the variable was set. When it was set to false, it was still firing which isn’t what you want and results in EVERY image having a fallback *facepalm*.

    This version works better because it tests if it’s set AND that it’s true:

    // Add the fallback, if requested
    if(isset($format->fallback) && $format->fallback)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Minor code bugs’ is closed to new replies.