Title: [Plugin: Simple Lightbox] Lightbox Max Size Image
Last modified: August 20, 2016

---

# [Plugin: Simple Lightbox] Lightbox Max Size Image

 *  Resolved [eaguilar9](https://wordpress.org/support/users/eaguilar9/)
 * (@eaguilar9)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/)
 * Hello, I was just wondering if there was a way to set a max-width on the lightbox.
   URL Sample: [http://www.thesoundpalace.com/news/recording-continues-for-christmas-cd](http://www.thesoundpalace.com/news/recording-continues-for-christmas-cd)
 * [http://wordpress.org/extend/plugins/simple-lightbox/](http://wordpress.org/extend/plugins/simple-lightbox/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Archetyped](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348839)
 * Hi,
 * Images are displayed at their original size to maintain optimum image quality.
   Resizing images to their desired display size prior to uploading is recommended.
 * This and other usage notes for SLB can be found at [SLB’s official page](http://archetyped.com/tools/simple-lightbox/).
 *  [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348926)
 * Archetyped, what about using SLB with the wordpress media sizes (the ones we 
   choose at Settings -> Media), letting the user choose which one or **automatically
   choose the ‘large’ one**.
 * We could tell the script to use the ‘large’ by using this function:
 * `<?php wp_get_attachment_image_src( $attachment_id, $size = 'large', $icon );?
   >`
 * [http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src)
 * This would return an array with the URL, width and height.
 * What do you think?
 *  [transparencia](https://wordpress.org/support/users/transparencia/)
 * (@transparencia)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348928)
 * Ok, here’s a solution (hack) to limit the images max size that uses the WordPress
   Media ‘Large’ size. (Note: You have to make sure that you go go Settings -> Media
   and set a width and a height on the **large** field. I use 750×500 and it works
   great!)
 * In /model.php insert this code in line 687 (before “Update Link in Content):
 *     ```
       //Replace the Image URL with the 'large' sized one
       $image_src = $attr['href'];
       $wpdb->query( $wpdb->prepare(" SELECT ID FROM {$wpdb->posts} WHERE guid = %s ", $image_src ) );
       $att_id = $wpdb->get_var($query);
   
       if ($att_id)
       {
            $image_large_attr = wp_get_attachment_image_src($att_id, 'large');
            $attr['href'] = $image_large_attr[0];
       }
       ```
   
 * In line 1092 of /model.php add the text “large” inside the empty apostrophes:
 * `$d = wp_get_attachment_image_src($att->ID, 'large');`
 * I’m not a coder and this code is probably not the best but it works!
 *  [ericschoeb](https://wordpress.org/support/users/ericschoeb/)
 * (@ericschoeb)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348940)
 * I like this solution, but with the version of the plugin I’m using (1.6.1), I
   don’t see anywhere to edit the wp_get_attachment_image_src() function. I’m assuming
   you’re using an older version of the plugin. If anyone has any additional insight
   though, it would be much appreciated.
 *  [Dave](https://wordpress.org/support/users/deeve007/)
 * (@deeve007)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348941)
 * That code works without the second bit added.
 *  [bornsupercharged](https://wordpress.org/support/users/bornsupercharged/)
 * (@bornsupercharged)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348956)
 * Thanks transparencia, it looks like 1.6.2 has it around 834. Adding that code
   fixed it for me!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: Simple Lightbox] Lightbox Max Size Image’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-lightbox.svg)
 * [Simple Lightbox](https://wordpress.org/plugins/simple-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-lightbox/reviews/)

 * 6 replies
 * 6 participants
 * Last reply from: [bornsupercharged](https://wordpress.org/support/users/bornsupercharged/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-simple-lightbox-lightbox-max-size-image/#post-2348956)
 * Status: resolved