Sample Downloads
I stumbled across a very useful phpclasses.org, developed by Bakr Alsharif, that could help developers detect nude photos of pictures based on skin pixel points.
It analyzes the colors used in different parts of a picture and determines whether they match the color tones of the human skin.
As a result of the analysis, he will return a value reflecting the likelihood that the picture contains nudity.
In addition, he can output the parsed picture, which marks the pixels that use the color of the given colour.
It is currently available to analyze png,gif and JPEG images.
The following shows how to use this PHP class.
Let's start with a nf.php file that contains a nude filter.
Next, create a new class called ImageFilter, and then put it in a variable called $filter.
$filter = new ImageFilter;
Gets the score of the picture and places it in a $score variable.
$score = $filter-> getscore ($_files[' img '] [' tmp_name ']);
If the picture score is greater than or equal to 60%, show an (alert) message.
if ($score >=) {
/*message*/
}
Here are all the PHP code:
<?php
/*include The nudity Filter file*/
Include (' nf.php ');
/*create a new class called $filter *
/$filter = new ImageFilter;
/*get the score of the image*/
$score = $filter-> getscore ($_files[' img ' [' tmp_name ']);
/*if the $score variable is set*/
If (isset ($score)) {
/*if the image contains nudity, display image score and M Essage. Score value if more than 60%, it are considered an adult image.*/
if ($score >=) {
echo "image scored". $score. "%, It seems that you have uploaded a nude the picture."
/*if the image doesn ' t contain nudity*/
} else If ($score < 0) {
echo "Congratulations, you have uploaded Non-nude image. ";
}
}
? >
Markup language
We can upload images using a basic HTML form.
<form method= "POST" enctype= "Multipart/form-data" action= "<?php echo $SERVER [' php_self '];? > >
Upload Image:
<input type= "file" Name= "img" id= "img"/> <input "type="
submit "value=" Sumit Image "/>
</form>