How to resize an image programmatically when creating node? I have created a content type with an image field. I have to add the content type programmatically.  From my form submit function I can get the fid like:

$product_image = $form_state['values']['announced_product_image'];


I'm wondering how I can programmatically resize an image when creating a node.

I have tried:

$test = file_load($product_image);
$img = image_load($test-&gt;uri);
image_resize($img, 200, 200);


But the image is not saving as 200x200.
Don't forget to use image_save() after you've resized it!