Last updated: Dec-11-2024
Cloudinary is a cloud-based service that provides an end-to-end asset management solution including uploads, storage, transformations, optimizations and delivery.
Cloudinary offers a very rich set of image uploading, transformation and management capabilities. Cloudinary allows you to upload images to the cloud, transform them on the fly and deliver them to your users optimized and cached via a fast CDN.
WebPurify offers an image moderation service based on human moderator experts. Cloudinary provides an add-on for using WebPurify's image moderation capabilities, fully integrated into Cloudinary's image management and transformation pipeline.
With WebPurify's image moderation add-on, you can extend Cloudinary's powerful cloud-based image transformation and delivery capabilities with automatically moderation of your photos. When using the WebPurify add-on, user uploaded images are automatically moderated, making sure that no adult or offensive photos are displayed to your web and mobile viewers.
Getting started
Before you can use the WebPurify Image Moderation add-on:
You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.
Register for the add-on: make sure you're logged in to your account and then go to the Add-ons page. For more information about add-on registrations, see Registering for add-ons.
Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant SDK guide.
If you're new to Cloudinary, you may want to take a look at the Developer Kickstart for a hands-on, step-by-step introduction to Programmable Media features.
Automatic image moderation flow
The following list describes the flow of uploading and displaying moderated images using Cloudinary and the WebPurify image moderation add-on:
-
Image upload
- Your users upload an image to Cloudinary through your application.
- The uploaded images are set to a 'pending' status, with short term CDN caching.
-
Image moderation
- The uploaded image is sent to WebPurify for asynchronous moderation in the background.
- The image is either approved or rejected by WebPurify's moderation add-on.
- An optional notification callback is sent to your application with the image moderation result.
- If the image is approved, its cache settings are modified to be long-term.
- A rejected image does not appear in the Cloudinary Console, but is backed up, consuming storage, so that it can be restored if necessary.
-
Manual override
- Pending, approved and rejected images can be listed programmatically using Cloudinary's API or interactively using our online Media Library Web interface.
- You can manually override the automatic moderation using the API or Media Library.
Request image moderation
Before you start, if you haven't done so already, please sign-up to a Free account. After signing up, you can try the WebPurify image moderation add-on for free and later on register for an add-on plan that best matches your usage requirements.
To request moderation of uploaded images, set the moderation
upload API parameter to webpurify
:
Learn more: Upload presets
The uploaded image is available for delivery based on the randomly assigned public ID with short-term caching of 10 minutes. Image moderation by the WebPurify add-on is performed asynchronously and should be completed within up to a few minutes.
The following snippet shows the response of the upload API call that signifies that the WebPurify moderation is in the pending
status.
Status notification
Due to the fact that the WebPurify add-on moderates images asynchronously, you might want to get notified when the moderation process is completed.
When calling the upload API with WebPurify image moderation, you can request a notification by adding the notification_url
parameter to a public HTTP or HTTPS URL of your online web application. Cloudinary sends a POST request to the specified endpoint when WebPurify moderation is completed.
The following JSON snippet is an example of a POST request sent to the notification URL when moderation is completed. The moderation_status
value in this case can be either approved
or rejected
:
The JSON content is signed using the API Secret of your Cloudinary product environment. For more details regarding Cloudinary's notifications and webhooks, see this blog post.
Image moderation list
Cloudinary's Admin API can be used to list all moderated images. You can list images with a particular status, including approved, pending or rejected images, by specifying the value of the second parameter of the resources_by_moderation
API method. For example to list all rejected images:
Example response:
Manual override
While the automatic image moderation of the WebPurify add-on is very accurate, in some cases you may want to manually override the moderation decision. You can either approve a previously rejected image or reject an approved one.
One way to manually override the moderation result is using Cloudinary's Media Library Web interface. From the left navigation menu, select Moderation. Then, from moderation tools list in the top menu, select WebPurify and then select the status (Pending, Rejected, or Approved) of the images you want to display.
- When listing the images rejected by WebPurify, you can click on the green Approve button to revert the decision and recover the original rejected image.
- When listing the images approved by WebPurify, you can click on the red Reject button to revert the decision and prevent a certain image from being publicly available to your users.
Alternatively, you can use Cloudinary's Admin API to manually override the moderation result. The following sample code uses the update
API method while specifying a public ID of a moderated image and setting the moderation_status
parameter to the approved
status.