I need a way to restrict authors from uploading images bellow specific dimensions.
Say I only want to allow uploading images that are at least 400px x 400px. If the image size is smaller, the author should get an error notice that the image is too small.
Is there a plugin or code that can accomplish this?
Add this code to your theme’s functions.php file, and it will limit minimum image dimentions
Then just change the numbers of the minimum dimensions you want (in my example is 640 and 480)
I prefer not to reformat a colleague’s code.
So, this is almost the same answer as @MaorBarazany’s, but checking the mime type, changing the
file['error']
declaration and changing the function namespace to this wpse Question ID.Also, the check only occurs for users that are not administrators.
Result of the hook: