I have built a custom form in Drupal 7. The form has a file type field which allows the user to upload an image. I'm using the below code in the submit function to save and re size the image:
function adddeals_submit($form, &$form_state){
global $user;
$file = $form_state['storage']['file'];
// We are done with the file, remove it from storage.
unset($form_state['storage']['file']);
// Make the storage of the file permanent
$file->status = FILE_STATUS_PERMANENT;
// Save file status.
file_save($file);
//get the url for the saved file
$url = file_create_url($file->uri);
echo $url;
echo '<br>';
$destination = 'public://ImageThumbnail';
$img = image_load($file->uri);
image_resize($img, 200, 200);
$result = image_save($img,$destination);
echo $result;
exit;
}
The image is re-sizing and saving correctly as the $result is printing 1. I need to know how to get the URL for the re sized image. Am I missing something?
Thanks for you help.