[Flow] Extract image EXIF data for resource objects and resize image on upload

Jan Greth jan at greth.me
Fri Aug 2 20:39:25 CEST 2013


Hey Robert,

you wrote me:
> For the time being you can use the stream wrapper URI "resource://" .
> $resource->getHash() for access to the actual file (in order to process
> it with some EXIF library). Be aware though that in future versions of
> Flow (that is: 2.1) you can't rely on that the file is stored in your
> local file system ...

Mh... now I tried for 2,5 evenings and didn't get it work.
I found a verry verry verry dirty solution but I don't want to have it.
Do you know a better way? See my condensed Example below

public function showAction(Index $index) {
/***
* Not working: Throws error message, PHP exif_read_data() wants
* a proper Path - no direct Data, no URL/URI.
* Also tried to get Path/URI by using Fluid Resource URI View Helper...
* didn't work -> no URL/URI allowed
***/
//$imageFile = 
file_get_contents('resource://'.$index->getImage()->getResource()->getResourcePointer()->getHash());

//Extremly(!!!) dirty, but working
$image = 
'../Data/Persistent/Resources/'.$index->getImage()->getResource()->getResourcePointer()->getHash();

//$meta is the Array with all the EXIF Data
$metaArr = exif_read_data($image, 0, true, false);
$this->view->assign('meta', $metaArr);
$this->view->assign('index', $index);
}


Perhaps you ment an other implementation of 'stream wrapper URI 
"resource://".$resource->getHash()' but don't know how... :(

Cheers
Jan


More information about the Flow mailing list