[development] Processing an image when a node is saved (D7)

Steve Yelvington steve at yelvington.com
Sun Feb 6 02:24:29 UTC 2011


I have a content type with an image field. I want to pull some metadata 
from the image file when the node is created or updated.  I thought this 
would be pretty straightforward, but I'm baffled by some things that are 
going on in D7.

I thought I'd implement hook_node_presave(). Apparently the image file 
isn't properly known by $node at that point. Krumo shows 
field_image['und'][0] but none of its child elements have useful 
information. And I have no idea what 'und' is all about.

I added node_load() to see if that would help. On an existing node, it 
makes a difference. Krumo shows:



More information about the development mailing list