forked from ppabcd/Instagram-Story-Downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkFace.php
38 lines (38 loc) · 1.41 KB
/
checkFace.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require __DIR__ . "/lib/FaceDetection.php";
if (!file_exists(__DIR__.'/face')) {
mkdir(__DIR__.'/face', 0777, true);
}
if (!file_exists(__DIR__.'/trash')) {
mkdir(__DIR__.'/trash', 0777, true);
}
if(!file_exists(__DIR__.'/profile/face')){
mkdir(__DIR__.'/profile/face');
}
if(!file_exists(__DIR__.'/profile/trash')){
mkdir(__DIR__.'/profile/trash');
}
foreach(glob(__DIR__."/data/*.jpg") as $filename){
if(file_exists(__DIR__."/face/".basename($filename)) || file_exists(__DIR__."/trash/".basename($filename)) ){
unlink(__DIR__."/data/".basename($filename));
continue;
}
if(detect_label(__DIR__."/data/".basename($filename))){
rename(__DIR__."/data/".basename($filename), __DIR__."/face/".basename($filename));
}
else {
rename(__DIR__."/data/".basename($filename), __DIR__."/trash/".basename($filename));
}
}
foreach(glob(__DIR__."/profile/*.jpg") as $filename){
if(file_exists(__DIR__."/profile/face/".basename($filename)) || file_exists(__DIR__."/profile/trash/".basename($filename)) ){
unlink(__DIR__."/profile/".basename($filename));
continue;
}
if(detect_label(__DIR__."/profile/".basename($filename))){
rename(__DIR__."/profile/".basename($filename), __DIR__."/profile/face/".basename($filename));
}
else {
rename(__DIR__."/profile/".basename($filename), __DIR__."/profile/trash/".basename($filename));
}
}