Stock Photos
Sveltia CMS includes built-in support for integrating free stock photo services directly into the media storage. This allows content creators to easily search for and insert high-quality images into their content without leaving the CMS interface.
Supported Services
Currently, Sveltia CMS supports the following free stock photo providers:
Future Plans
More providers, including paid stock photo services, will be added in future releases.
Requirements
You must obtain API keys for each stock photo service you wish to use. Register for developer accounts at the following links to get your API keys:
CSP Settings
If your site uses a Content Security Policy (CSP), you may need to update it to allow requests to stock photo providers. See the CSP documentation for more details.
Configuration
No additional configuration is required to enable stock photo providers, as they are included by default. However, developers can customize which providers are available or disable them entirely.
To enable or disable specific stock photo providers, you can modify the providers array in the media_libraries section of your config.yml file. For example, to enable only Unsplash, you would configure it as follows:
media_libraries:
stock_assets:
providers:
- unsplash[media_libraries.stock_assets]
providers = ["unsplash"]{
"media_libraries": {
"stock_assets": {
"providers": ["unsplash"]
}
}
}{
media_libraries: {
stock_assets: {
providers: ["unsplash"],
},
},
}To disable stock photo providers, you can set the providers array to be empty in the media_libraries section of your config.yml file, as shown below:
media_libraries:
stock_assets:
providers: [][media_libraries.stock_assets]
providers = []{
"media_libraries": {
"stock_assets": {
"providers": []
}
}
}{
media_libraries: {
stock_assets: {
providers: [],
},
},
}Using Stock Photos
Stock photos can be accessed directly from the Image field in the Sveltia CMS interface. When opening the Select Images dialog, you will see stock photo options alongside your existing media storage. Select the desired stock photo provider and provide your API key to enable the service. API keys are stored securely in the browser’s local storage, so you don’t need to enter them every time.
By default, curated images from each provider are available for quick access. You can also use the search functionality to find specific images based on keywords.
When you find an image you want to use, simply select it, and it will be inserted into your content just like any other media asset. The CMS may show a dialog where you can copy the image credit information to comply with attribution requirements.
Note that some providers require hotlinking to the image’s original URL, while others rather disallow hotlinking. Sveltia CMS handles this automatically based on the provider’s policies, and downloads the image to your media storage if necessary.
Multi-user setups
If your CMS instance is used by multiple users, you as an administrator need to distribute your API key to all users to let them use the stock photo feature.
Alternatively, each user can provide their own API key. However, this is not recommended for instances with non-technical end-users because generating and managing API keys may be challenging for them.
Limitations
Due to the non-hotlinking policies, some stock photo providers are disabled if the internal media storage is disabled due to the lack of the media_folder option in the configuration.