I would like to check an image before uploading it to the server.
I need to check if it has a minimum width and height, 300dpi and only jpg.
I’m using the next function to invoke the upload process, except it invokes on every upload not for a certain post type.
add_filter('wp_handle_upload_prefilter','tc_handle_upload_prefilter');
function mf_handle_upload_prefilter($file)
{
// do checks and return error if fails
return $file;
}
Does anyone know how to do this?
Can I maybe at an extra value to the $file parameter which I can use?
Or is there another way to do this?
ps. I has to be before the upload itself!
The solution: