BoxLang 🚀 A New JVM Dynamic Language Learn More...

PicPurify

v1.0.1 Modules

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.

$ box install picpurify

No collaborators yet.
     
  • {{ getFullDate("2019-12-23T02:57:03Z") }}
  • {{ getFullDate("2020-05-22T12:55:51Z") }}
  • 2,832
  • 54