Is there a way to set a «min-width» for images to a «SafeCracker File»-Field (type: Images)?

We have a SafeCracker-Form, where Users are allowed to upload Images — but these should have a min-size of 512x512 Pixels.

There are Settings for max-width/-height in edit_upload_preferences, but I haven't found settings for min-width/-height so far.

1 Answer 1


Unfortunately the EE file upload library has no extension hooks you can use to add extra routines to the process of uploading files from outside the File Manager.

However, you could use SafeCracker's safecracker_submit_entry_start hook (docs) to inspect your upload (which will likely be in the $_FILES global variable), run getimagesize() on it (docs), and then if it doesn't meet your minimum requirements, return an error:

return $this->EE->output->show_user_error('submission', 'Your image does not meet the minimum size requirements.');

That should get you started.

Your Answer

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

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