Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Dear All:
How to get image field url in the computed field ? I tried many method but all not work
like:
$image = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_image)));
$path = file_create_url($image->uri);
$entity_field[0]['value'] = $path;
also tried node_load
entity_metadata_wrapper
whatever method does not work
Please help!
thanks
Comments
Comment #1
gokhangulgezen CreditAttribution: gokhangulgezen commentedHi
$path = file_create_url($entity->field_your_image[und][0][uri]);
$entity_field[0]['value'] = $path;
probably this will solve your problem. You just need to replace "field_your_image" with your image field machine name.
bye