Hi all,
I am trying to access all of the information on my media entity objects and pass them on to another service. When I do a var_export($entity) I can see all of the information that I need. It looks something like:

stdClass::__set_state(array(
'fid' => '161',
'uid' => '1',
'filename' => 'dancin-tree.jpg',
'uri' => 'temporary://dancin-tree_5.jpg',
'filemime' => 'image/jpeg',
'filesize' => '123023',
'status' => '1',
'timestamp' => '1302808292',
'type' => 'image',
'file' =>
array (
'und' =>
array (
0 =>
array (
'uid' => '1',
'status' => 1,
'filename' => 'dancin-tree.jpg',
'uri' => 'temporary://dancin-tree_5.jpg',
'filemime' => 'image/jpeg',
'filesize' => 123023,
'source' => 'upload',
'destination' => 'temporary://dancin-tree_5.jpg',
'timestamp' => 1302808292,
'fid' => '161',
'type' => 'image',
'original' =>
stdClass::__set_state(array(
'fid' => '161',
'uid' => '1',
'filename' => 'dancin-tree.jpg',
'uri' => 'temporary://dancin-tree_5.jpg',
'filemime' => 'image/jpeg',
'filesize' => '123023',
'status' => '0',
'timestamp' => '1302808292',
'type' => NULL,
'rdf_mapping' =>
array (
),
)),
'display' => true,
),
),
),
'field_refid' =>
array (
'und' =>
array (
0 =>
array (
'value' => 'MyReferenceId333',
),
),
),
'field_ccid' =>
array (
'und' =>
array (
0 =>
array (
'value' => 'MyCCId333',
),
),
))

To access the entity information I understand that the entity wrapper is the way to go:

$wrapper = entity_metadata_wrapper('media', $entity);
$field = 'field_refid';
$result = $wrapper-> $field->value();
echo($result);

The return of the above is: MyReferenceId333

I'm still not sure how to get the file specific meta-data in the entity though. Like the fid, filename, uri, filesize etc in the above array?

Any help would be greatly appreciated!

Thanks!

Comments

JacobSingh’s picture

Status: Active » Closed (cannot reproduce)

The media modules doesn't use entity anymore, so I don't know what you would use that for.

Why not use the first form?