Don't crop images in lightbox


Is there a way to stop cropping images that are displayed in the lightbox?

All images are cropped the same way, which is fine because it results in a very clean look. But I’d prefer if the image that appears in the lightbox (when you click on an image in the listings images) would not be cropped.

The user then could upload landscape images, portrait images and squared images. For the preview the images are all cropped resulting in the same width and height, but when a visitor clicks on an image to open the lightbox the visitor would see the whole images rather than the cropped version.

I’m talking about this lightbox popup:

Is there a way to achieve this?

Thank you

It’s possible, but this would require overriding this template part hivepress/listing-images.php at master · hivepress/hivepress · GitHub We use the “large” image size by default (registered by WordPress), it’s set to 1024px max (eighter height or width), I recommend keeping it because larger images may affect the performance.

Is it possible to make the image always 1024px and then adjust the height automatically.

Let’s say someone uploads an image with 2000px in width, 4000px in height. It then would adjust the image to 1024px in width and 2048px.

When someone uplaods a image 4000px in width, 2000px in height it would adjust it automatically to 1024px in width and 512px in height.

Is this possible and if so, could you please provide the code snippet?

Thank you a lot!

Please try adjusting this size in Settings/Media, e.g. set height to 9999px then only the width will be affected, the height will be automatic depending on the aspect ration (changes apply to newly uploaded images only) Screenshot by Lightshot

Hi there!

I did that and it worked, however I noticed some behavior that I don’t like and I need it to be fixed. My Settings/Media are the default settings besides the little change that you just told me.

I uploaded an image which is 746x1730px. I noticed that it gets cropped differently (with different dimensions) then larger images. It’s because of the “Landscape size (large)” setting which is 800x600px.

I changed it to 400x300px and uploaded the image again and the dimensions are all equal now which is great. However, now the quality is really bad.

Is there a way to always crop by the exact dimensions of 800x600px?

I believe the thumbnail has this feature already.

How can I make it work for “Landscape size (large)” as well?

Thank you

Unfortunately there’s no way to do this in the WordPress image uploader, if smaller images are uploaded then WordPress leaves images “as is” #23713 (Image editor: Remove help text about unsupported image upscaling) – WordPress Trac Please consider keeping the 800x600 dimensions for the Landscape (Large) size, most of the photos nowadays are significantly larger in any case.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.