Skip to main content
Language

From Remote URL

PhotoEditor SDK supports loading filters from a remote URL, this can be a resource hosted by a photo hosting provider or your own servers. In this example, we load custom LUT and duotone effects.

Download filters#

For each filter, we construct a remote URL from the filter filename and create a download task. Upon successful download we save it to a temporary location after checking if a file already exists at that location and removing it if necessary.

Dispatch to main queue#

In order to keep the UI responsive and prevent race conditions while the filter files are downloading, we dispatch to the main queue. Here, we keep track of the finished download task and the locations of the downloaded filters by writing to a downloadLocations dictionary.

Create effect objects#

Now once all filters have finished downloading, we can retrieve their local URLs and identifiers from the downloadLocations dictionary and pass them to the LUTEffect and DuoToneEffect constructors, respectively.

Add filters to asset catalog#

In order to add the new filters to our asset catalog, we first add the default items and then append our filters to the effects array.

Create filter groups#

In cases where we want to simplify navigation and discovery, we can group sets of related filters which will appear in a single folder in the filter tool. Simply create a Group passing a unique identifier, a display name for the group and a thumbnail for the group folder.