Responsive Lightbox by dFactory
link to large image instead of full size (8 posts)

  1. french50
    Posted 2 years ago #


    the plugin is really great, but one excellent addition to it could be to offer the possibility to choose what image size the lightbox must open.

    i have found a solution that work perfectly, but not when responsive lightbox is active ( overwritting ? ) : http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/

    if anybody has got the solution...


  2. dFactory
    Plugin Author

    Posted 2 years ago #

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

  3. french50
    Posted 2 years ago #

    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.

  4. dFactory
    Plugin Author

    Posted 2 years ago #

    It's not our philosphy, it's just how WordPress works. Read this for example: http://www.wpbeginner.com/wp-tutorials/how-to-create-additional-image-sizes-in-wordpress/ or google for more info on image sizes in WP.

  5. joewnhu
    Posted 2 years ago #

    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.

  6. dFactory
    Plugin Author

    Posted 2 years ago #

    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.

  7. Geet Jacobs
    Posted 2 years ago #

    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));
  8. Chadwickhugh
    Posted 2 years ago #

    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: http://wordpress.org/support/topic/how-to-make-media-file-link-to-large-image-instead-of-full-size?replies=2

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Responsive Lightbox by dFactory
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.