Support » Plugin: Responsive Lightbox by dFactory » link to large image instead of full size

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author dFactory


    This has nothing to do with the plugin, really. Image size are determined by your theme and RL just handles the images provided.



    I understand your philosophy, it’s just that some other plugins include this.

    Do you have any clue on how i can make it work with RL ?

    You say that image size is determined by the theme, but this possibility ( link a thumbnail to a large or medium or… ) is not included in wordpress.

    Plugin Author dFactory


    It’s not our philosphy, it’s just how WordPress works. Read this for example: or google for more info on image sizes in WP.

    Not sure if this is resolved yet, but I figured I post this for others. The solution in the oiko post will work with responsive lightbox if you adjust the $priority variable to something higher than 1000.

    add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 2000, 4);

    I walked through the code a bit and discovered that in add_gallery_lightbox_selector, the link is overwritten. Since the oiko solution ran prior to add_gallery_lightbox_selector, the links always reset to the link for the full image. Or at least that is how I interpreted it. 🙂

    Hope this helps others.

    Plugin Author dFactory


    It doesn’t require any filters. If you insert image into post there are image sizes settings. And your theme is displaying images there must ba an image size defined in a theme.

    joewnhu is correct in how to solve this with oiko solution by changing the $priority variable but it would be nice to have the file link size be built into the plugin.

    dFactory: you are correct there is a size setting for the gallery shortcode like the below:
    [gallery size="large" link="file" ids="113,114,115,116,117"]

    but the size=”large” relates to the thumbnails that the gallery displays, not the link=”file”. The WordPress gallery shortcode uses the full sized image for the “file” link.

    What would be nice is in the main settings for your plugin to have a File Link drop down setting that links into all available sizes for the theme and let you select it.

    Setting option with either a dropdown to select the size or a text field to enter your own image size value:

    Below is where I could see it being used very easily in your plugin.

    public function add_gallery_lightbox_selector($link, $id, $size, $permalink, $icon, $text)
    		$link = (preg_match('/<a.*? rel=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 '.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'$2', $link) : preg_replace('/(<a.*?)>/', '$1 rel="'.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'">', $link));
    /* Get the image URL and the size from the settings*/
            $image = wp_get_attachment_image_src( $id, $this->options['settings']['file_link_size'] );
    /* Replace the full file URL with the new sized image URL */
    		return (preg_match('/<a.*? href=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? href=(?:"|\')).*?((?:"|\').*?>)/', '$1'.$image[0].'$2', $link) : preg_replace('/(<a.*?)>/', '$1 href="'.$image[0].'">', $link));

    I am essentially trying to find a solution to the same problem, though it doesn’t really have to be Lightbox specific. The oikos hack works for galleries, but not just plain thumbnails linked to the media file, which is the majority of my blog.

    See my post:

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘link to large image instead of full size’ is closed to new replies.