Ratings | | Unique User Downloads | | Download Rankings |
72% | | Total: 275 | | All time: 7,663 This week: 524 |
|
Description | | Author |
This class can blur an image when it is not safe for non-adults.
It can check if a given image is safe for non-adult users by sending a API request to Mashape.
The class can generate a blurred version of the image when it is not safe. Innovation Award
October 2016
Number 4
Prize: 1 year subscription to the Basic Plan of an API product of choice |
Some sites need to receive images from users that may not be safe for displaying to non-adults.
In this case it may be better to avoid showing those images to children. However, when you don't know if the user is not an adult, it would be better to show an obfuscated version of the image.
This class can use an API to determine if an image is not safe for showing to non-adults. It can also return a blurred version when it is the case, thus avoid showing the image explicitly.
Manuel Lemos |
| |
|
|
Innovation award
Nominee: 9x |
|
Example
<?php
include('SafePreview.php');
// Init
$safePreview = new SafePreview();
// set lang
$safePreview->setLang('en');
// set logo path
$pathLogo = 'images/logo/logo.png';
$safePreview->setLogo($pathLogo);
// set image path
$pathImage = 'images/origin/image.jpg';
$safePreview->setPathImage($pathImage);
// set image blured path
$pathBlured = 'images/blured/blured.jpg';
$safePreview->setPathBlured($pathBlured);
// set image url
$urlImage = 'http://{YOUR_URL}/safePreview/src/images/origin/image.jpg';
$safePreview->setUrlImage($urlImage);
// set image blured url
$urlBlured = 'http:/{YOUR_URL}/safePreview/src/images/blured/blured.jpg';
$safePreview->setUrlBlured($urlBlured);
// set the condition (add alert message: do you want to see it anyway?)
$safePreview->setCondition(TRUE);
// verify if image safe
$isSafe = $safePreview->isImageSafe();
if(!$isSafe) {
// if image not safe
$safePreview->mergeImages();
// show blured image
$html = $safePreview->showPreview();
} else {
// show original image
$html = $safePreview->showOriginal();
}
?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<?php echo $html;?>
|
Details
lutian/safePreview
> graphics-tools
Show blured image and alert message with your logo when picture is not safe
- Include integration with mashape.com to recognize if picture contain porn or adult content
- Add logo of your company inside the blured image
- Add alert message inside the blured image (optional, if condition is FALSE you can not view the original image)
- You can add diferents font files to change the font type of alert message (arial by default)
Version
0.1
Authors
-
[Luciano Salvino] - <lsalvino@hotmail.com>
Installation
To use the tools of this repo only has to be required in your composer.json:
{
"require":{
"lutian/safePreview": "dev-master"
}
}
Use
include('SafePreview.php');
// Init
$safePreview = new SafePreview();
// set lang
$safePreview->setLang('en');
// set logo path
$pathLogo = 'images/logo/logo.png';
$safePreview->setLogo($pathLogo);
// set image path
$pathImage = 'images/origin/image.jpg';
$safePreview->setPathImage($pathImage);
// set image blured path
$pathBlured = 'images/blured/blured.jpg';
$safePreview->setPathBlured($pathBlured);
// set image url
$urlImage = 'http://{YOUR_URL}/safePreview/src/images/origin/image.jpg';
$safePreview->setUrlImage($urlImage);
// set image blured url
$urlBlured = 'http:/{YOUR_URL}/safePreview/src/images/blured/blured.jpg';
$safePreview->setUrlBlured($urlBlured);
// set the condition (add alert message: do you want to see it anyway?)
$safePreview->setCondition(TRUE);
// verify if image safe
$isSafe = $safePreview->isImageSafe();
if(!$isSafe) {
// if image not safe
$safePreview->mergeImages();
// show blured image
$html = $safePreview->showPreview();
} else {
// show original image
$html = $safePreview->showOriginal();
}
echo $html;
License
MIT
[Luciano Salvino]:http://mueveloz.com/
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.