Profiles
You can apply the same options to multiple images or 360 spins by creating profiles.
Profiles let you easily apply and update styles on images/spins across your website, without changing any code. When profile settings are updated in your Sirv account, every image/spin referencing that profile will also update.
Apply a profile
To apply a profile, append ?profile=name to the image/spin URL. name should be the file name of the profile you'd like to apply (found in your Profiles folder).
Example:
https://demo.sirv.com/look.jpg?profile=Example-Text
Create a profile
To create a profile:
- Go to your Profiles folder and click "New profile":
- Enter a name for your profile:
- Choose the settings you wish to apply, such as a text overlay:
- Click Save.
In the example above, the new profile was named Example. You would apply it to an image like so:
https://example-account.sirv.com/my-image.jpg?profile=Example
Order of processing
If the same option is applied via multiple sources, the source with the highest precedence is used, in this hierarchy:
- URL (highest precedence)
- Profile
- Default profile (lowest precedence)
For example, if "quality" is only set in the Default profile, that value will apply. If "quality" is also set in a custom profile and in the URL (e.g. q=75), then the URL option will take precedence.
Add profile to folder
You can apply a profile to files in a folder (and its subfolders) without appending the ?profile parameter in the URL. This is called a strict profile - all settings within the profile will be strictly applied and cannot be overridden by adding conflicting parameters in the URL. This has many uses, such as applying irreversible watermarks to images.
Apply a strict profile
Follow these steps to apply a strict profile.
1. Go to the Protected URLs settings of your Sirv account:
This feature is for paid accounts priced from $199/month. To try this feature, please ask the Sirv support team.
2. Create a new protection:
3. Sirv offers 3 types of protection. Choose the strict profile:
4. Choose the folder and which profile should be applied to the images within it:
6. Click create.
Up to 10 folders (and their subfolders) can have this protection. If you need more than 10 configurations, please ask the Sirv support team.
Example
We configured the folder /Examples/Strict with a profile that applies a watermark and text overlay. The master images on the Sirv account remain as they were - whenever they are served the profile is applied:
https://demo.sirv.com/Examples/Strict/Idra.jpg
Profile code
Profiles are text files, written in JSON.
As they're just text files, with a predictable format, you can even create your own profiles in your application.
This example shows the content of a typical profile. This will apply a text layer to your images and spins:
{ "image": { "scale": { "width": 1280 }, "frame": { "style": "none" }, "text": { "text": "Text overlay", "style": "simple", "font": { "family": "Open Sans" }, "position": "southeast", "color": "cyan", "opacity": 50, "background": { "color": "red", "opacity": 10 }, "size": 34 } }, "spin": { "width": 400, "zoom": 2.5 } }