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

Robert Lemke robert at typo3.org
Mon Aug 5 09:56:32 CEST 2013


Hi Jan,

Jan Greth wrote:

> 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);
> }

very dirty indeed ;-)

I really enhanced the Resource Management API a lot for Flow 2.1 - but 
it's not finished yet. There'll be an API method 
$resourceManager->getPrivateStorageUriByResource$resource) which will 
return exactly what you'll need:

$metaArr = 
exif_read_data($resourceManager->getPrivateStorageUriByResource($image->getResource()), 
0, true, false);

I hope to finish this part during the next two weeks or so. Does it make 
sense for you to wait until then?

see also: 
http://robertlemke.com/en/blog/preview-cloud-resources-for-typo3-flow-21.html

Cheers,
Robert


More information about the Flow mailing list