• Hey great work on this awesome plugin!

    The plugin seems to use the original/full size of the image when a thumbnail is clicked for an enlarged view.

    Is there a way I can change this so that either the “large” size or a custom image size is used instead?

    I don’t see an option for this in the admin panel settings, but I am comfortable enough to code in the solution myself with a little bit of guidance. My only concern is that I wouldn’t want my changes to be overwritten if/when I upgrade the plugin to a newer version.

    Any help would be greatly appreciated. Thanks!

    http://wordpress.org/plugins/responsive-lightbox/

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

    (@evster)

    Note that I’ve tried the solution at http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/, which applies a filter to the gallery call allowing me to specify loading of the “large” image size. However it only works on the native WP gallery and not when I have the Responsive Lightbox plugin activated.

    Plugin Author dFactory

    (@dfactory)

    Your filter uses preg_replace, same as our plugin (it is used to apply rel=”lightbox” to image links). I thinks thats the reason we’re having problems here.

    Please try applying that filter at later stage – give it for example a 100 parameter, instead of the default 10 and see if it works then.

    Hi, I’m interested in finding out the solution to this as well. I’ve tried the above using 100 in the filter but that didn’t work.

    Does anyone else have any ideas – it does seem strange to load the full-size image rather than large as clients are often unaware of the importance of file size.

    This is the code I’ve used

    function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) {
    
        // Only do this if we're getting the file URL
        if (! $permalink) {
            // This returns an array of (url, width, height)
            $image = wp_get_attachment_image_src( $post_id, 'large' );
            $new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content );
            return $new_content;
        } else {
            return $content;
        }
    }
    
    add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 100, 4);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use custom image size instead of "full" size’ is closed to new replies.