Drupal: Programmatically saving imagefield images

Posted by Ace on Stack Overflow See other posts from Stack Overflow or by Ace
Published on 2010-06-04T09:20:54Z Indexed on 2010/06/07 8:52 UTC
Read the original article Hit count: 220

Filed under:
|
|
|
|

Hey there!

I'm trying to write a sync function that saves some data to nodes, which works fine, until I try to save the thumbnail image associated with the node.

I've managed to download the file and put it in my sites/default/files folder, but what's the best way to tell Drupal, "put this file in that CCK imagefield"?

EDIT To clarify a bit.. I sync the thumbnails separately (since one image can be used by several nodes)... I would like the initial thumbnail sync to save the files in the correct folder (not a temp one) and just point the imagefield to this file... That's what annoys me with field_file_save_file(), it saves a new file instead of just making a pointer.. Any advice?

© Stack Overflow or respective owner

Related posts about php

Related posts about image