Support » Plugin: Lightbox with PhotoSwipe » Don’t want to show full sized image in lightbox

  • Resolved sgrx



    Thanks for the free plugin. We’re using the Classic Editor and we’ve set that by default, images inserted into a post are linked to the media file and the size of the images to be shown in the post is the large size.

    This plugin shows the original, full sized image in the lightbox instead of the selected size which is shown in the post, in this case being the “large” image that I have defined in WP (max 1024×1024).

    Is there any way I can get the lightbox to show the “large” or another size instead of the full size of the image? This would help decrease the loading time of the images in the lightbox as a full sized image can be a few MBs at times…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Arno Welzel


    The problem is, that the plugin does not know anything about image sizes – it will just use what is linked. If you don’t want to show full size images, you have to create links to the reduced size and not the original images.

    In theory I could add an option to determine the currently supported image sizes of the active theme and offer to change the image links in the HTML output on the fly – but this could create a lot of additional problems with existing image gallery plugins.

    Thanks. Any suggestions on how to create links to the reduced size?

    I can’t find much info on it except the image_send_to_editor filter, where I can modify the URL. Not sure if this is the best approach out there.

    Plugin Author Arno Welzel


    Well – you can always add manual links to the smaller sizes instead of the original media.

    image_send_to_editor is one way – but then you have to edit all posts/pages and insert your images again so the new URLs will be used.

    Another approach might be to replace the existing image links in the output using an output filter.

    See, line 71, line 339, line 322 and line 233 and following.

    My plugin takes the output, tries to identify image links and adds additional attributes to the links so the Photoswipe script will use them for the lightbox. In line 267 I identify the internal ID of the image based on the URL in the image link. This could be used to replace the URL with a link to a smaller version.

    Just as a hint – there are still a lot of things to implement like getting the real size of the reduced image etc..

    Maybe it’s way easier for you if you just upload smaller images, which are ok to be used for the full size view.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Don’t want to show full sized image in lightbox’ is closed to new replies.