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

PicPurify

v1.0.0 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.

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1.0.0 Dec 23 2019 02:57 AM Dec 23 2019 02:57 AM

 

$ box install picpurify

No collaborators yet.
     
  • Dec 23 2019 02:57 AM
  • Dec 23 2019 02:57 AM
  • 250
  • 0
  • 0