$article = entity_create('node', array(
'type' => 'article',
'title' => generate_demo_content('lorem_ipsum_title'),
'body' => array(
'value' => generate_an_article(),
'format' => 'full_html',
),
// how attach here, a file or an image?
));
$article->save();
I create an article from a .module file, and I would like know if I can link an image/file object to my article?
By example if I have an image inside /modules/my_module_name/images/img.jpg, how I can insert this image inside my article object from my .module file please?
Thanks.