I am using webform to upload images to display dynamically on the site.

I would like to be able to use Drupals built in image_scale function that I have seen in the user.module to force the uploaded images to be a specified size.

Is there a way to have webform run this function on a file upload?

Comments

quicksketch’s picture

You can use this additional processing code to resize images within a specific file component (assuming you named the form key "file_upload"):

$form_key = 'file_upload';
$file = unserialize($form_values['submitted_tree'][$form_key]);
image_scale($file['filepath'], $file['filepath'], 200, 200);
doctorquad’s picture

Thanks

It worked Perfectly.

quicksketch’s picture

Title: Image size » Resize Images on Upload
Category: feature » support
Status: Active » Closed (fixed)

Closing after lack of activity.

marianista’s picture

Please....could you tell me where have i to write this code to make it run???

salientknight’s picture

Anyone know of a way to do this with webform 3?

hassan.farooq121’s picture

Issue summary: View changes

Where to use this? in a presave hook?