Cloudinary App Installation Guide
Cloudinary is an assets management tool for websites and mobile applications covering everything from uploading, storage, optimization, and delivery.
Contentstack Marketplace lets you install the Cloudinary application and use it within your stack to refer media files from your Cloudinary account.
Prerequisites
- Cloudinary account
- Contentstack account
- Access to the Contentstack Organization/Stack as the Owner/Admin
This step-by-step guide explains how to install and configure Cloudinary within your stack.
Steps for Execution
- Get your credentials from Cloudinary
- Install and Configure Cloudinary in Contentstack Marketplace
- Use Cloudinary within your Stack
-
Get your credentials from Cloudinary
To get your Cloud Name and API Key from Cloudinary, follow the steps given below:
- Log in to your Cloudinary account.
- In the left-hand side primary navigation, click Settings. Then, go to Account, and scroll down to see the cloud name.
- Click Access Keys in the left navigation panel to view the API Key.
- Save the Cloud Name and API Key; you will need it while configuring your Cloudinary app in Contentstack.
-
Install and Configure Cloudinary in Contentstack Marketplace
Follow the steps to install the application in Contentstack.
- Log in to your Contentstack account.
- In the left-hand side primary navigation, click the Marketplace icon to go to the Marketplace.
- Click Apps from the left panel.
- Within the Marketplace, you can see all the available apps. Hover over the Cloudinary app and click Install App.
- In the popup window, select the stack where you want to install the Cloudinary app, accept the terms and conditions, and click the Install button.
- On the Configuration screen, enter the following details:
- Enter the Cloudinary Cloud Name and API Key retrieved from your Cloudinary Account in step 1.
- Save in Entry: Choose how to save the data fetched from the Cloudinary account in Contentstack entries. If you select the All Fields option, you can select only a limited number of assets in the entry. For Custom Fields, you can search and add specific Cloudinary Fields you want to save in entries.
Warning: When you change the settings from All Fields to Custom Fields, and vice versa, any existing assets will follow the old configuration settings, whereas newly added assets in the entry will store the data according to the updated configuration settings.
If you select Custom Fields then the Cloudinary Keys dropdown appears in which public_id, resource_type, and secure_url Cloudinary Keys options are selected by default. If you want to create a new key, click the + New Key Field option.
In the Add Key Path modal, enter the Cloudinary Key Path and click the Create or Create and Apply button to create a new key.
You can map nested or complex structures in the following manner:- While mapping nested fields, you must specify the object and its field using the dot(.) notation.
For example, Object.age for accessing the age field within the object. - While mapping arrays, use indexing.
For example, Array[1] for accessing the second value of an array.
Example: Cloudinary Object
{ "public_id": "mens_nyfw_banner_efpxor", "resource_type": "image", "tags": ["mensignal", "womenwear"], "metadata": { "product_id": "0" }, } eg: tags[1] and metadata.product_id
- While mapping nested fields, you must specify the object and its field using the dot(.) notation.
- On the UI Locations tab, you can see the predefined app locations. You can use the toggle button corresponding to each UI location to enable or disable it based on your requirements.
- Click the Save button.
- Click Open Stack to start using the Cloudinary application.
Note: The Save in Entry feature is applicable to Cloudinary Custom Fields only.
Additional Resource: For more information on UI locations, please refer to the Installed Apps guide.
Use Cloudinary within your Stack
To use the Cloudinary application within an entry of your stack, follow the steps given below:
- Go to your stack and click the Content Models icon in the left navigation panel, and click the + New Content Type button.
- Create a content type by adding relevant details as displayed below:
There are two ways to use the Cloudinary application in your entry.
Steps to use Cloudinary within the Custom field
- In the Content Type Builder page, add a Custom field in your content type by clicking the Insert a field link represented by a + sign.
- Under Select Extension/App, select Cloudinary and click the Proceed button.
Change the Display Name of the custom field to your choice, for example, Cloudinary Custom Field. Optionally, you can add Help Text and Instruction Value for your custom field. This adds the Cloudinary app in the custom field.
- Under the Advanced Properties tab, you can set the maximum number of assets that can be added in the custom field inside Config Parameter, as shown in the following screenshot:
Add an object named as advanced which includes a key named max_limit and its value as the maximum number of assets you want to add, in the following format:{"advanced":{"max_limit":3}}
- After adding the app, click Save or Save and Close to save your changes.
- To use the Cloudinary app, create an entry for this newly created content type. To do this, in the left navigation panel, navigate to the Entries page, click + New Entry to create a new entry for the above content type, and then click Proceed.
You can see the Cloudinary app’s custom fields on your entry page as shown below: - Click the + Choose Asset(s) button to select assets from your Cloudinary account.
- If you are not logged into your Cloudinary account, it will ask you to enter your credentials. Once you do that, you are directed to your assets sections. Select the image file(s) and then click the Insert button to add them to your entry.
- Hovering over the image will allow you to reorder, preview, or remove it.
- To reorder the image, hover over it and select the Reorder icon. This will allow you to drag and reorder the image to your desired position.
- To preview the image, hover over it and select the Preview icon. You will be able to view the image in a new tab.
- To delete the image, hover over it and select the Remove icon.
Thumbnail View
List View
- Once you have added the assets, Save and Publish your entry.
To change the assets view, select List from the drop-down menu as shown in the following screenshot:
The assets you insert get referenced within your entry in the list view.
Note: Once you add the maximum number of assets, as defined in config parameter, the Choose Assets button gets disabled. You cannot add more assets than the preconfigured limit in the Custom field.
Steps to use Cloudinary within the JSON Rich Text Editor field
- In the Content Type Builder page, add JSON Rich Text Editor in your content type by clicking the Insert a field link represented by a + sign.
- To add the Cloudinary plugin in JSON RTE, click the Properties icon of JSON RTE, and under Select JSON RTE Plugin(s), choose the Cloudinary app, and then click the Add Plugin(s) button.
- After adding the plugin, click Save or Save and Close to save your changes.
- To use the Cloudinary app as JSON RTE plugin, create an entry for this content type. You will see the Cloudinary app icon inside the JSON RTE field in your entry page as shown below:
- Click the Cloudinary app icon to open the selector page or Media Library.
- If you are not logged into your Cloudinary account, it will ask you to enter your credentials. Once you do that, you are directed to your assets sections. Choose one or more media files from the Media Library and then click the Insert button.
The selected asset(s) gets displayed in the JSON RTE editor: - You can resize the image by adjusting the size from the corners.
- Hover over the image to preview, edit, or remove it.
- Click the Preview icon to view the image.
- Click the Edit icon to edit the image. Make the necessary changes and click the Save button.
- Click the Remove icon to remove the selected image.
- To add inline text to the selected image, follow the steps below:
- Drag and resize the image as required.
- Click the Edit button, choose the right or left alignment, check the Inline Asset checkbox, and then click the Save button.
- Add the required text next to the image.
The assets you select are referenced within your entry. You can add more assets by following the steps as discussed above, or simply save and publish your entry as it is.