0

We have a requirement where the minimum and maximum image resolution 480x480 for an image on upload. The reason is that we want the image to be resized to be exactly 480x480.

However, whenever we upload an image that is larger than 480x480, we are constantly getting the following error message. Even when i modify the maximum to be 640x480 i still get the error message for an image that is 1200x968.

Need some help figuring out what could be the issue as i have tried to modify the maximum image resolution to be slightly larger than the minimum image resolution, but still get the error message.

enter image description here

2
  • Are you saying both the maximum and minimum size requirements are set to 480x480 and you're having trouble uploading an image bigger than that? Or are you wanting any uploaded image to be resized to that size? Nov 11, 2017 at 4:37
  • @Blake Morgan so if an image that has a resolution smaller than 480x480 then the image should be rejected but if the image is larger than 480x480 then it should be resized to that. Nov 12, 2017 at 6:25

1 Answer 1

1

Reformatting an image won't happen on upload, it will happen on display of the content. If you want to reject anything less than 480x480, set that as the minimum in the field's setting and don't set a maximum size.

Field settings

To resize the image, be sure there is an image style set to resize an image to 480x480 (which is included by default in Drupal 8). Then under the "Manage Display" field of the content type, click the gear next to the image field and select the desired image style that you want displayed.

Image style.

4
  • the requirement is to resize on upload. So let's say the minimum is set 480x480, but the maximum is set to 640x480 then the error still occur. The system should reject anything smaller than 480x480, but resize any image larger than 640x480 down to that size. However, when i have those settings, i am still getting the same errors. How can this be resolved (purpose of post)? Nov 13, 2017 at 3:04
  • To resize on upload, you'd have to create a module that will do that (there already is one for 7, but not 8) or do it programmatically. If the size of the photo on the server doesn't matter, then this solution will work for you. Nov 13, 2017 at 4:08
  • so you are saying that having a setting of min 480x480 and max 680x480 will not work in drupal 8? Nov 13, 2017 at 16:11
  • 1
    i found the solution. i had to set only the minimum image resolution, but decided to use the Responsive IMage module. Instead of assigning the default Image Style, i assigned the image field to responsive image with what i needed, then i was able to met all the requirements. Setting the minimum and use the image style helped me find the solution (i was just missing the responsive image module). Nov 13, 2017 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.