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?
Kinda solved this myself I think. I field_file_save_file() my thumbnails separately and then field_file_load() them when syncing the nodes.
Seems to be working alright. 🙂