Hi,
Is it possible to add a minimum image size in some way? I have found that some of my users are uploading images that are far too small and I would love to stop that.
I found the following code online, that does work with the Media Library, but doesn't seem to work with WPUF. What happens is the image does not upload, but there are no messages to state why which means users would not know why their images are not uploading.
add_filter('wp_handle_upload_prefilter','tc_handle_upload_prefilter');
function tc_handle_upload_prefilter($file)
{
$img=getimagesize($file['tmp_name']);
$minimum = array('width' => '640', 'height' => '480');
$width= $img[0];
$height =$img[1];
if ($width < $minimum['width'] )
return array("error"=>"Image dimensions are too small. Minimum width is {$minimum['width']}px. Uploaded image width is $width px");
elseif ($height < $minimum['height'])
return array("error"=>"Image dimensions are too small. Minimum height is {$minimum['height']}px. Uploaded image height is $height px");
else
return $file;
}
I hope you can help.
Damien