FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

PicPurify

v1.0.1 Public

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="[email protected]";

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.

Dependencies (0)


Dev Dependencies (0)


 

$ box install picpurify

No collaborators yet.
     
  • Dec 23 2019 02:57 AM
  • May 22 2020 12:55 PM
  • 515
  • 0
  • 23