DAM offers even more rules that can be used to modify the DAM record before it enters the database. Suppose your site deals with a lot of photographs, submitted by editors from all over the world. Images have good metadata describing the location of the shot, stored in IPTC tags. In this recipe, we will create a rule to add a category to these images based on the location where they were taken.
We will also use a different method for extending TYPO3—we will not create an extension, but rather make all the needed changes in the local instance. This makes sense in cases of specialized snippets of code that are not easily reusable, or are simply unique in their nature.
We will use the embedded metadata specifying the country and city to select an appropriate category. To fully test this code, you need to have a category tree with several countries, and their corresponding cities, and the files with embedded metadata that matches these locations.