I've created an image field programmatically in Drupal 7. I want to set a minimum width and a minimum height on the image, so it checks whether the image is large enough.

The imagefield I've created:

$form['box_image'] = array(
    '#type' => 'media',
    '#title' => t('Image'),
    '#default_value' => isset($content['settings']['box_image']) ? $content['settings']['box_image'] : '',
    '#theme' => 'media_widget',
    '#media_options' => array(
      'global' => array(
        'types' => array('image'),
        'schemes' => array(
          'public' => 'public',
        'file_extensions' => 'png gif jpg jpeg',
        'max_filesize' => '500 KB',
        'uri_scheme' => 'public',
        // Can I set the min width and height here?

Is this possible? Thanks.

1 Answer 1


Problem solved. If you use Media browser, like me you could use: 'min_resolution' => '750x500'.

Your Answer

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

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