Images
To make use of images with Ucommerce, you will need to implement your image service based on the IImageService
interface.
Prerequisites
Before implementing your custom Image Service with Ucommerce, ensure the following:
External Data Source: You need access and necessary permissions to fetch and format data from an external source and into Ucommerce. If you are using a CMS, you could consider using any asset management system implemented in that.
A Digital Asset Management (DAM) system is highly recommended for efficient asset management and reliable functionality.
IImageService
The IImageService
interface provides three distinct methods for retrieving content. These methods cater to various use cases within the system.
Get
MethodThis method is commonly used by the backoffice media picker and is designed to retrieve a list of content.
Parameters:
parentId
: Filter the content based on the parent ID. Default isnull
.startAt
: Define the starting point for the retrieval. Default is 0.limit
: Set a limit on the number of content items to retrieve. Default is 30.token
: Cancellation token for task management. Default isnull
.
Usage:
The media picker relies on this method to:
Retrieve all content.
Initially (when no ID is set) obtain the first root folder in the list and then invoke the method again with this folder's ID as the root.
Note:
As a result, the first elements in the list should typically represent some form of root object.
GetById
MethodThis method is designed to fetch image content by a specific ID.
GetByIds
MethodThis method is intended to retrieve all content items associated with a list of specified IDs.
All of these methods should fetch and filter your data, based on your external data source.
Related articles
MediaLast updated