• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • ๐Ÿ˜Œ This community is user driven. Be polite with other users.
    • ๐Ÿ‘‰ Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • ๐Ÿ’ธ Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Auto detect Adult Content and hide

imgyukle

๐Ÿ’– Chevereto Fan
https://chevereto.com/community/thr...-for-nudity-detection-tagging-and-more.10046/

After See this topic, i wrote a sample code using Realtime Image Moderation API of https://www.moderatecontent.com/

PHP:
<?php
include('dbconnectfile.php'); //Your database config file
date_default_timezone_set('Europe/Moskov'); // Your time zone
$time=date('Y-m-d H:i:s');
$ptime=date('Y-m-d H:i:s',strtotime('-5 minute')); // You should set your time interval for which content check
$result = mysqli_query($link,"SELECT * FROM chv_images WHERE image_date BETWEEN '$ptime' AND '$time'");
$find=0;
if (mysqli_num_rows($result)>0){
while($r=mysqli_fetch_array($result))
{
$find++;
$imageid=$r["image_id"];
$imagename=$r["image_name"];
$imagex=$r["image_extension"];
$imagedate=$r["image_date"];
$times=date("Y-m-d", strtotime($imagedate));
$timesp=explode('-',$times);
$imgurl='https://i.imgyukle.com/'.$timesp[0].'/'.$timesp[1].'/'.$timesp[2].'/'.$imagename.'.'.$imagex.''; //change to your image direct link and folder type
$links='https://www.moderatecontent.com/api/v2?face=true&key=YOUR API KEY&url='.$imgurl.'';
$file_get_contents=file_get_contents($links);
$parse=json_decode($file_get_contents);
$rating=$parse->rating_label;
if ($rating === "adult"){
mysqli_query($link,"UPDATE chv_images SET image_nsfw='1' WHERE image_id='$imageid'") or die(mysql_error());
}
echo '<p>'.$rating.'</p>';
}
}

Get your key from https://www.moderatecontent.com/documentation/signup

Customize this code for your prefer and implement Api key

After create a cronjob for this file with same time interval.

That's all ๐Ÿ˜‰

Also,image detecting keep 1 or 2 second per image, therefore image detecting can keep long time if you give long time interval, i think short time interval good for this
 
Can you share sample of dbconnectfile.php
PHP:
<?php
$link = mysqli_connect("localhost", "DBuser", "DBuserpass", "DBname");

if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}
mysqli_select_db($link, 'DBname') or die("Could not open the db 'DBname'");
?>

here, you can use this for Mysqli ๐Ÿ˜‰
 
I have a problem the variable $file_get_contents is returning bool(false) I check the url and its fine the are information.

Any solution to solve this?

Thanks
 
Very cool, thanks !

Some integration exemple for fun :
https://images.guru/i/ICAp

View attachment 2142
could you help me adding this feature to my site? idk where to put code in. I would like to have rating box like yours have as well on my site.

I tried adding code into image.php but didn't work so i hope some 1 here can help me guide properly so my site can have rating box + that it can put images into NFSW idrectly if it's adult content.
 
Last edited:
The example is wonderful.
I now have this on my version of the script and let the uploaded pictures of users with a cron of X minutes has checked a maximum of 10 pictures.

Unfortunately, it is not possible to do more at once since I will probably have to set the maximum execution time of PHP.
For 10 pictures, this takes approximately 32-48 seconds.

The data is stored in the database so that it does not have to be retrieved.
 
Last edited:
What files do I need to edit?
A simple editing of a file is not necessarily enough.

In my case, I created a file that searches for new uploads in a certain time interval using a cron job.
If there are (new) uploads that have not yet been checked, the process will check the new images and then write (update) the corresponding values into the database.

I used file /app/themes/Peafowl/overrides/views/images.php to display the corresponding values.

The code of @imgyucle in post#1 served as the basis for all of this.
For me, however, this has been greatly expanded because I couldn't leave it at that.
 
How to fix this error?
Using PHP 7.4.4
Code:
PHP Notice:  Undefined property: stdClass::$rating_label in /home/nginx/domains/moderate.php on line 22

Thanks!
 
How to fix this error?
Using PHP 7.4.4
Code:
PHP Notice:  Undefined property: stdClass::$rating_label in /home/nginx/domains/moderate.php on line 22

Thanks!
If it is for the code of the first post, then it lacks the condition where you check if $parse actually parsed.
 
Thank you very much, but I like adult content and don't need this for the time being.๐Ÿ˜€
 
How to fix this error?
Using PHP 7.4.4
Code:
PHP Notice:  Undefined property: stdClass::$rating_label in /home/nginx/domains/moderate.php on line 22

Thanks!
I also get it from time to time. Its because this is a free service and sometimes it returns an error which I guess due to the size of the image or load on their servers. Check out my custom implementation of this in my signature.
 
  • Like
Reactions: rdn
I also get it from time to time. Its because this is a free service and sometimes it returns an error which I guess due to the size of the image or load on their servers. Check out my custom implementation of this in my signature.
Is because the code assumes 100% success results which you can't ever do with a remote service.

The code lacks of a fail condition.
 
  • Like
Reactions: rdn
I have a problem the variable $file_get_contents is returning bool(false) I check the url and its fine the are information.

Any solution to solve this?

Thanks
I am getting the same issue, did you solve yours?

##
NEVERMIND, JUST REALISED ITS INTEGRATED NOW ๐Ÿ˜€ good job
 
Last edited:
Back
Top