From Remote URL
PhotoEditor SDK supports loading frames from a remote URL, this can be a resource hosted by a photo hosting provider or your servers.
Although the editor supports adding assets with remote URLs, we highly recommend that you manage the download of remote resources yourself, since this gives you more control over the whole process. In this example, we add a custom dynamic frame by directly passing the remote URLs in the configuration. For an example of how to download the remote resources in advance see the font example.
Dynamic frame#
Dynamic frames consist of four groups, corresponding to each side of the frame. In our example, we opt for the "horizontal inside" mode of arranging image tiles providing only a middle image for the left and right parts of the frame and a start, middle and end image for the top and bottom parts. Refer to the guide on dynamic frames for an in-depth explanation.
We create a dynamic frame using FrameAsset
. It takes in a unique identifier (used for serialization/deserialization purposes), CustomPatchFrameAsset
, and relative scale. A CustomPatchFrameAsset
takes in the frame layout mode (HorizontalInside
or VerticalInside
), and the four image groups (top, left, right, bottom).
The relative scale is used to describe how big the frame should be with respect to the photo it will be applied to.
Add frame to AssetConfig
#
AssetConfig
#To use the frame, it must first be available in the SDK's backend. This is done by adding the frame to the AssetConfig
.
Configure UiConfigFrame
#
UiConfigFrame
#Here, we configure UiConfigFrame
and add the custom FrameItem
to the frameList
.