Skip to content
A CFML wrapper for the PicPurify content moderation API
ColdFusion
Branch: master
Clone or download
Latest commit 9e1d468 Dec 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ModuleConfig.cfc
PicPurify.cfc
README.md
box.json

README.md

cfmlbadges cfmlbadges cfmlbadges cfmlbadges cfmlbadges cfmlbadges cfmlbadges cfmlbadges

PicPurify

A CFML wrapper to interact with the PicPurify content moderation API.

Installation

This component can be installed as standalone or as a ColdBox Module. Either approach requires a simple CommandBox command:

box install picpurify

ColdBox Module

This package is also a ColdBox module. The module can be configured by creating a picpurify configuration structure in your application configuration file (config/Coldbox.cfc) with the following settings:

picpurify = {
     apiKey = '<YOUR_API_KEY_GOES_HERE>' // Your PicPurify API Key
};

Then you can inject the CFC via Wirebox:

property name="picpurify" inject="picpurify@picpurify";

Usage

Instantiate the component:

picpurify = new picpurify( APIKey = '<YOUR_API_KEY_GOES_HERE>' );

picpurify.analysePicture()

Returns a CFML struct from the API response

var stuResponse = picpurify.analysePicture(
    task      = 'porn_moderation,suggestive_nudity_moderation',
    url_image = '<REMOTE URL FOR IMAGE FILE>'
);

picpurify.analysePicture()

Returns a CFML struct from the API response

var stuResponse = picpurify.analyseVideo(
    task      = 'porn_moderation,suggestive_nudity_moderation',
    url_video = '<REMOTE URL FOR VIDEO FILE>'
);

picpurify.isNSFW(text)

isNFSW() is a helper mathod added to this component.

Pass in the CFML struct response from the API request.

Returns a boolean for whether or not the image / video is NSFW (Not Safe For Work)

var isNSFW = picpurify.isNSFW(
    apiResponse = stuResponse
);

Acknowledgements

PicPurify is based on the official PicPurify API.

You can’t perform that action at this time.