[development] D6 Adding an image to a node for viewing

jeff at ayendesigns.com jeff at ayendesigns.com
Tue Feb 1 17:16:29 UTC 2011


The problem doesn't seem to be getting to the $node->content structure. 
That's present in $node when I hook during op=view. The problem seems to 
be getting the data into the right place in a cck image field in 
$node->content.  If I were copying the body text from one node the one 
being viewed, I could just set $node->content->body['#value'] equal to 
the new text, but $node->content->my_cck_imagefield doesn't have a 
'#value', the field info is at

$node->content->my_cck_imagefield['field']['items'][0]['#item']

when I hook, that element only contains #delta=>0

then I set #item = the array containing

[fid] =>  11
     [list] =>  1
     [data] =>  Array
         (
             [description] =>
             [alt] =>
             [title] =>
         )

     [uid] =>  1
     [filename] =>  myimage.jpg
     [filepath] =>  sites/mydomain.com/files/myimage.jpg
     [filemime] =>  image/jpeg
     [filesize] =>  174602
     [status] =>  1
     [timestamp] =>  1296425237
)

and the dsm() output of the node after that shows that #item still only 
contains #delta=>0, so I'm missing the piece of how/where I replace the 
field contents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110201/1ad2c47b/attachment.html 


More information about the development mailing list