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->uri);
image_resize($img, 200, 200);

But the image is not saving as 200x200.

  • Why not use the core imagecache module ?
    – Countzero
    Commented May 23, 2012 at 16:12

1 Answer 1


Don't forget to use image_save() after you've resized it!

  • duh, that did it! i was wondering why my changes weren't persisting....ty
    – dm03514
    Commented May 23, 2012 at 15:55

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.