Hi, does anybody have a proposal for reading the EXIF or IPTC data from uploaded photos in the document entity?
Announcement
Collapse
No announcement yet.
Exif Data
Collapse
X
-
Hello,
maybe formula
but the return value is big data.. maybe put in a matrix or only some value
PHP Code:$data = exif_read_data( 'data/Interligne.jpg' ); // document->get(fileId). to verify for have path of file and attribute.
$data['Make'];
$data['Model'];
Last edited by item; 05-09-2021, 09:20 PM.
- Likes 1
-
Meanwhile I found this Chrome Plugin: https://chrome.google.com/webstore/d...anjggkmjapkffm
You get all Metadata of an image (in documents) by right-click. It does not work on the images in the data/upload folder.
Would be perfect, if we could integrate something like that in espoCRM.
- Likes 1
Comment
-
I tried to create a custom function for formula, but I don`t understand the documentation and comparing the present formula functions does not help me either.
The exif formula though should not be too difficult for a developer. It is a function already implemented in apache to read the exif data and output in an array.
Perhaps anybody could point me in a direction.
Comment
-
document hooks afterSave : just test is file is image and if isset(data['value'])
i think that do what you will.
can too possible by button custom service
PHP Code:public function afterSave(Entity $entity, array $options = array())
{
$data = exif_read_data( "data/upload/" .$entity->get("file")->id );
$entity->set([ "model" => $data["Model"] , "make" => $data['Make'] ]);
$this->entityManager->saveEntity($entity, ['skipHooks' => true]);
}
- Likes 1
Comment
-
item , thank you for your effort, but I am totally lost. I don`t know, how to use this. What do I have to adapt for my entity.
I put this file with some additional code (name of my entity is exifDaten):
Code:<?php namespace Espo\Custom\Hooks\ExifDaten; use Espo\ORM\Entity; class AccountName extends \Espo\Core\Hooks\Base { public function afterSave(Entity $entity, array $options = array()) { $data = exif_read_data( "data/upload/" .$entity->get("file")->id ); $entity->set([ "model" => $data["Model"] , "make" => $data['Make'] ]); $this->entityManager->saveEntity($entity, ['skipHooks' => true]); } }
Code:custom/Espo/Custom/Hooks/exifDaten/exifHook.php
I have the impression, that nobody at espoCRM wants anybody to really learn, how to use these things, one has already to know. Pity, frustrated.
Comment
-
Hello,
first you say "Document" .. then i think out-of-box Document entity .. so adapt name to your entity !
fileName = className !
so for you : exifDaten .. but firstLetter must UpperCase as all entity ExifDaten
custom/Espo/Custom/Hooks/ExifDaten/ExifDatenHook.php
PHP Code:<?php
namespace Espo\Custom\Hooks\ExifDaten;
use Espo\ORM\{
Entity,
EntityManager,
};
class ExifDatenHook extends \Espo\Core\Hooks\Base
{
public function afterSave(Entity $entity, array $options = array())
{
$data = exif_read_data( "data/upload/" .$entity->get("file")->id );
if (isset($data['Model']) && isset($data['Make']) ) {
// in this sample, model and make = field ..
$entity->set([ "model" => $data["Model"] , "make" => $data['Make'] ]);
$this->entityManager->saveEntity($entity, ['skipHooks' => true]);
}
}
}
Last edited by item; 05-11-2021, 08:04 PM.
- Likes 1
Comment
-
-
Hi,
I still get an Error:
Code:[2021-05-12 07:19:44] WARNING: E_WARNING: rename(data\tmp\tmpCF15.tmp,data\cache\application\classmapControllers.php): Zugriff verweigert (code: 5) {"code":2,"message":"rename(data\\tmp\\tmpCF15.tmp,data\\cache\\application\\classmapControllers.php): Zugriff verweigert (code: 5)","file":"G:\\laragon\\www\\Werkverzeichnis\\application\\Espo\\Core\\Utils\\File\\Manager.php","line":308} []
the image, from which I want the exif data, is saved in the documents (field: "file"). I created a new entity ExifData, which only has fields according to exif data (I used the names of the exif data like "make", "model" etc.) and the relationship field to the image document. This entity is linked by a 1:1 relationship to documents, so that I can take one image from the documents and the entity ExifData should extract the exif data from that related image and populate the fields with the data. For every meta data type I have one field (not an array for all fields), to be able to use certain data for other purposes.
Comment
-
Hello,
this error is not related to hook or customisation but something permission.
how i do :
i have a custom job for test .. so before implement i do all my test in job and run job by terminal.
when result of job is ok.. i implement in hook or service.
as you see below, i have put a jpg in folder data and print result to terminal.
i run job: php command.php run-job JobName
PHP Code:public function run()
{
$data = exif_read_data( 'data/Interligne.jpg' );
print_r( $data );
}
Comment
-
Hello guys,
We have already developed an extension named Image Plus that includes this functionality:
Espocrm, Ebla Image Plus for EspoCRM enables extraction and mapping of Exif data to entity fields, facilitating organized storage and retrieval of image metadata. With the planned feature Global Image Library, users will be able to access images globally from any entity like Espocrm does with documents, so you will not be forced to duplicate sameimages.
- Likes 2
Comment
Comment