When rendering text on an image,
enter PHP code that will return your dynamic text. Do not use <?php ?> tags.
EG
return format_date(time());
return $file_data->description ? $file_data->description : $node->teaser;
Note that executing incorrect PHP-code can break your Drupal site.
Many different types of data derived from the image may be available as php values:
$node
return $node->title;
return format_date($node->created);
$image
return $image->source;
return basename($image->source);
return $image->info["filesize"];
$file_metadata
$file_data
is namespaced, structured and attributed, so can be complex to read.
drupal_set_message('<pre>'. print_r($file_metadata,1). '</pre>'); return "";
$file_data
$file_data
with no namespaces and all-lowercase attribute names.
$file_metadata->Iptc4xmpCore:Scene['pjmt:0'] = "exterior view";
becomes $file_data->scene = "exterior view"
return $file_attributes->description
return $file_attributes->copyright
If it's an image.module image then a $node
object with its values
may be available.
If it's an image that has been attached to a node using CCK filefield imagefield
(or just filefield)
then as well as the parent $node
object,
the $file_data
object that may contain a file description
(or other meta supplied by cck) from that file field.
return $file_data->description;
So far that seems to be the only available 'data' provided by filefield,
but you can investigate the node structure using devel.module or print_r()
to see what else this array actually contains.
If it's a file that's just been attached using upload.module,
a $file_data
object may also have a description.
return $file_data->description;
If the image path is detected as belonging to more than one node, just the data for the first one found is returned.
If you have meta_inspector available, then many more (namespaced)
metadata fields may be available on the $file_metadata
and $file_data
object.
Note that they will often be structured arrays.
$attname = "dc:creator"; return @reset($file_metadata->$attname);
See the documentation for the meta suite and HOOK_metadata_from_file()
for more about this data structure..