I'm using managed_file in a form to uplaod multiple images (D7).
$form['img_upload1'] = array(
'#title' => t('Image'),
'#type' => 'managed_file',
'#upload_validators' => array(
'file_validate_extensions' => array('gif png jpg jpeg')),
'#default_value' => variable_get('img_upload1', ''),
'#upload_location' => 'public://uploads_users/mydir/'.$userId,
);
Allowed file-extension are checked when the user chooses an image and in the form-validate-function the filesize is checked. The images should have a max hight of 730px or max width of 970px.
I can find the dimesions of the uploaded picture bud don't know how to resize it. Is there a way to add a scaling-function (an image-style?) to the managed_file-formfield or to the validation-function to resize the image before ore after the upload?
Thanks
UPDATE Thank you for your hints. The idea behind all was to have the original files available in a defined dimensions for an other purpose. Bud I see the benefits of using the "Drupal-way".