If your marketing team want to search assets by Width and Height you can provide this functionality with a few configuration changes. If you are new in Content Hub world then let me explain what you can do with Sitecore Digital Asset Management (DAM):
- Centralize photos, layouts, artwork, video, 3D, source files, and more.
- Categorize and search high volumes of material quickly and easily.
- Leverage artificial intelligence (AI) for automated content tagging and image sourcing for reuse.
- Share your saved collections of assets with other users.
- Manage metadata, digital rights management (DRM), security, and global distribution.
The effect that you want to achive is to have the following filters:
By default, width and size are part of the File properties property. File properties is a json property with asset metadata, but you cannot search thru this property.
Modify metadata processing
You have to add two new properties and fill them with valid data. First, go to the Settings and find ImportMetadataConfiguration. To get detailed information about metadata processing, please read the documentation.
In Sitecore Content Hub™, you use the MetadataConfiguration setting to control the mappings between the metadata in the uploaded file and the asset properties. The metadata configuration is saved in a JSON file that lists the metadata properties retrieved from the uploaded file and the asset properties where the metadata is to be mapped.Sitecore Content Hub Documentation
To complete the task, you should know that we have two sections, From and To, in the configuration.
- From: lists the metadata to be extracted from the uploaded file.
- To: lists the asset/file properties where the metadata is to be mapped.
When a file is uploaded to the Content Hub, two entities are created M.File and M.Asset. The To section in the metadata configuration starts with the file entity properties and continues with the asset entity properties using the related attribute. To extend an asset with new properties, you have to add these properties in a proper place.
Extend M.Asset schema definition
You enabled metadata processing to fill the Width and Height properties. Now you have to extend the M.Asset definition with new properties to store values. You can add properties to an existing group or create a new one.
For example, let’s create a new Dimensions group with two properties, Width, and Height.
When you add a new property, please modify the default settings:
- Check Include in content to make property searchable
- Uncheck Allow updates because Width or Height properties are read-only
You’ve almost completed your mission. The next step is to refresh metadata.
Metadata is processed once when the asset is uploaded. Therefore, to fill new Width and Height properties with values, you have to refresh renditions for all uploaded images. If you have a lot of items, this operation will take time. During this time, you can do the final step – extend the assets search component.
Extend search component
To modify the search component on the Assets page, you have to go to Manage->Pages and next choose an Assets page. In the Main Zone, there is a search component. If a component is disabled, you need to enable it and click on the component to go to component configuration.
When the component is open, choose a Query builder tab. There please add two new filters, Width, and Height. Click on + button. Change Type to field and Definition to M.Asset, than in Field drop down select Width. Repeat the same actions for the Height filter.
Now you can Save all changes and go to the Assets page. New filters should be available in the Advanced section.
Wideo recording will be available soon. Follow me on the Twitter or subscribe my blog updates