I'd like to import images for my direct created nodes via script. As i find in related topics it can be done in such way:

scripts for direct DB creation of nodes
// field_image - CCK imagefield
$node->field_image[0]['value'] = $image;

but it doesn’t work.

what is $image in this case - path and image name? Or simply image name?

I also tried following function from imagefield modul, but ....

/**
* insert a file into the database.
* @param $node
* node object file will be associated with.
* @param $file
* file to be inserted, passed by reference since fid should be attached.
*
*/
function imagefield_file_insert($node, &$file, $field)

Does anyone have an example of php script that can add images?
Thanks.

Comments

lukevr’s picture

sorry, this is link on scripts for direct DB creation of nodes : http://drupal.org/node/67887

lukevr’s picture