How can I restrict image upload dimensions for non-admin WordPress users?

Question

I want to restrict the dimensions of images uploaded by anyone who is not an administrator in WordPress to a specific size. I also want to return a specific error feedback when the image uploaded doesn’t meet the requirements.

For example: If I set the restriction to width of 500px and height of 700px, if a user tries to upload anything different from my specified width and height, it will be rejected and return a message that says, image size should be of size 500px by 700px in jpg format only.

I found a solution that only requires minimum dimensions but it’s a little bit away from what I want (How to Require a Minimum Image Dimension for Uploading?).

0
, , Patrick Aziken 1 year 2020-07-24T20:10:27-05:00 0 Answers 58 views 0

Leave an answer

Browse
Browse