[TYPO3-dam] Automatic categorization while importing

Thorsten Boock t.boock at exinit.de
Fri Sep 26 11:53:44 CEST 2008


Völker Stefan schrieb:
> Hi Thorsten,
> 
> sounds interesting!
> I will definetly have a look at this function -first thing in the morning
> 
> Best regards,
> Stefan.
> 
> 
> Am 25.09.2008 um 17:39 schrieb Thorsten Boock:
> 
>> Völker Stefan schrieb:
>>> Hello DAM-lovers,
>>>
>>> is it possible, to use one of the metadata-fields for automatic
>>> categorization?
>>>
>>> I have this in my mind:
>>> An image is saved via Adobe Bridge with following keywords "animal",
>>> "nature", "CMS".
>>> It will be uploaded into the DAM and while the automatic indexing
>>> process, the comma-separated keywordlist will be used to categorize this
>>> image in following categories: "animal", "nature" and "CMS".
>>>
>>> I don't believe, that there is already a solution for this, but i want
>>> to know, on which place (e.g. hook) i can implement this little feature
>>> as described above.
>>> Where do i have to "register" my "keyword-to-category"-function?
>>>
>>> Thank you very much in advance,
>>>
>>> Stefan.
>>
>> Hi,
>> I'm trying to do exactly the same right now. As I had my first look on
>> DAM about 7 hours ago I'm not exactly sure if I really got it but have
>> you had a look on the file class.tx_damdemo_sv1.php of the
>> demo-extension, yet? I think the function processMeta is the right place
>> to call your code. The meta-array given to this function as a parameter
>> contains the iptc-data and thereby the keywords you are looking for.
>>
>>
>> Regards,
>> Thorsten Boock
>> _______________________________________________
>> TYPO3-project-dam mailing list
>> TYPO3-project-dam at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-dam
> 

Hi Stefan,

after taking a closer look at class.tx_dam_indexrulebase.php again, I 
have to revoke my previous comment.

If you overwrite $meta['fields']['category'] in the function 
proccessMeta, it will be overwritten again at some later point. Changing 
  the title field in processMeta for example works perfect. As I don't 
have much time to finish the project I'm currently working on, I'm 
unable to research the problem more precisely.

Maybe the following (very dirty but extremly useful) testing-code helps 
you a little bit:

function postProcessMeta($meta, $abs) {
	exec('echo "'.print_r($meta, true).'" >> /home/thorsten/exiftest3.txt');
	exec('echo "'.print_r($abs, true).'" >> /home/thorsten/exiftest3.txt');
	}

At the point where the function is called the datasets corresponding to 
the indexed files are allready inserted into the database and you can 
read their uids from $meta['fields']['uid']. This makes it very easy to 
execute an updatequery. The variable abs contains the full path to the 
indexed file. The function gets called for every single file.

Of course this additional query will cost you script-runtime and thereby 
it isn't a beautiful solution - but I think it will be my way to do it 
because of the lack of time.

Regards,
Thorsten Boock


More information about the TYPO3-project-dam mailing list