Jump to content

Minimum dimensions of uploaded images depending on portrait or landscape format


Juergen
 Share

Recommended Posts

It would be great if the minimum dimensions of uploaded images could be set differently for portrait and landscape format and not only in general.

In my case I have added a lightbox on the frontend for the uploaded images. So if an image is in landscape format it should has a minimum width of 600px (and a proportional height of approx. 400px). If I upload an image in portrait format it should has a minimum height of 600px (and a proportional width of approx. 400px). The reason is that all images should have approx. the same size for the lightbox view.

I run into troubles if I add minimum dimensions of height and width at 600px, because a portrait format in the dimensions of height:600px and width:400px will be abortet, because the min. dimension for the width is set to 600px in this case. For the lightbox view the size of the image would be ok.

At the moment it is only possible to add height and width minimum dimensions for the image in general.

So a sepearate setting field for portrait and landscape formate would be great.

Best regards Jürgen

Link to comment
Share on other sites

While your idea is great I'd suggest another systematic. It would be better to restrict images by it's area and not by edge sizes, e.g. 400x600, as well as 600x400, results in an area of 240k px and it would also allow for images sized 490x490 meaning it's not dependent on any format.

  • Like 1
Link to comment
Share on other sites

I'm not sure if that is a really good solution... someone could also add panoramic images with weird dimensions like 100x10.000

why don't you just set the minimum to 400x400 ? then it would fit 600x400 and also 400x600. maybe an additional option for the area could make sense, like minimum 400x400 and area of 240.000, so 500x500 would work but 400x500 would NOT.

but don't you think that could get a little complicated for the clients? what error message would you display? "please upload a picture with at least 400x400 pixels and an area of at least 240.000 square pixels"? :P

  • Like 1
Link to comment
Share on other sites

If area size is used to control the dimensions it would be difficult to create an error message.

If specific sizes are used for portrait and landscape format it should be no problem. With php you can check if the image is in portrait format or landscape format and therefore you can output the specific message.

"The size of the uploaded image is lower than the allowed size of 400px/600px. Please upload a larger image".

And no I dont think that this procedure is complicated for clients. ;)

why don't you just set the minimum to 400x400 ? then it would fit 600x400 and also 400x600.

This is what I did at the moment. But my goal is that the images in the lightbox view should have approx. the same size. I dont want one picture with 400x400px and another with 400x600px in the lightbox view. I want to achieve more consistency. That was the reason for this posting.

Link to comment
Share on other sites

But my goal is that the images in the lightbox view should have approx. the same size. I dont want one picture with 400x400px and another with 400x600px in the lightbox view. I want to achieve more consistency. That was the reason for this posting.

Besides all the good and valuable points here mentioned, but for the moment: what's about to crop the images automatically for oputput in the lightbox to e.g. 400 x 600. If I would need minimum dimensions 400 x 600 or 600 x 400, I would set both min fields to 600 and then, depending on the ratio, crop / resize the images to the exact dimensions, 400x600 or 600x400. And yes, I know, it depends on the clients if they are able to check the result of uploaded images on the frontend. :)

Link to comment
Share on other sites

Just throwing silly ideas/theories in the air.

Chances are that you have already thought about these.

Couldn't there be 2 image fields merged/combined with something like the FieldtypeConcatenate Module?

Or, for example, an option, hook, or whatever that would say something close to:

2 minimums entered (lower/smaller min and higher/bigger min).

If the image is in Portrait mode/its width is lower than its height, then the lower min becomes the min width authorized. And the higher min becomes the min height authorized.

If the image is in Landscape mode/its height is lower than its width, same logic...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...