WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. french50
    Member
    Posted 8 months ago #

    hello,

    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...

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

  2. dFactory
    Member
    Plugin Author

    Posted 8 months 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
    Member
    Posted 8 months 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
    Member
    Plugin Author

    Posted 8 months 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
    Member
    Posted 7 months 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
    Member
    Plugin Author

    Posted 6 months 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
    Member
    Posted 3 months 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
    Member
    Posted 1 month 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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.