Transform your face using Artificial Intelligence with PHP FaceApp API
FaceApp is an Android and iOS application.
This library is an unofficial wrapper to their AI system.
- PHP >= 7.0
- cURL/PHP
<?php
require('FaceApp/faceapp.php');
try {
$FaceApp = new FaceApp('test/image.jpg');
$photoCode = $FaceApp->getPhotoCode();
//to get all available filters use : $FaceApp->getFilters();
$filter = 'old';
$FaceApp->applyFilter($photoCode, $filter, false);
if ($FaceApp->savePhoto('newImage.jpg')) {
echo "Done!";
}
} catch (Exception $e) {
exit($e->getMessage());
}
$FaceApp = new FaceApp('PHOTO_PATH');
Get the 'photo unique id' that has Been uploaded to faceapp servers
$photoCode = $FaceApp->getPhotoCode();
Get all filters are available to apply the photo
$photoCode = $FaceApp->getFilters(); //returns an array of filters
/*filters :
-no-filter
-smile
-smile_2
-hot
-old
-young
-hollywood
-fun_glasses
-hitman
-mustache_free
-pan
-heisenberg
-female
-female_2
-male
-no-filter
-impression
-goatee
-mustache
-hipster
-lion
-bangs
-glasses
-wave
-makeup
*/
Get the code of photo has Been uploaded to faceapp servers
$FaceApp->applyFilter(PHOTO_CODE , SELECTED_FILTER , CROP_FACE_OR_NOT);
//example :
//PHOTO_CODE(string) : $photoCode
//SELECTED_FILTER(string) : 'old'
//CROP_FACE_OR_NOT(bool) : true or false
Save the final filtered photo
$FaceApp->savePhoto('NEW_PHOTO_PATH.jpg');
As you may know this service has some limits for requesting so I created a "Proxy Mode" for it
Proxy servers has been added to faceapp.php line 44
All of them works well but i dont guarantee them to work for a long time
If you have any proxy server you can put it in the list
And you can turn the proxy server on with this code
$FaceApp = new FaceApp('PHOTO_PATH', true );
Take a look at "ProxyMode.php"
Faceapp PHP API
is licensed under the MIT License - see the LICENSE file for details
Of course it is not a perfect and optimized project but u can develop it easily and improve it even better than me 😄❤
if there is any question or problem contact me in Telegram @SubString or report it in issues.
Enjoy!
اصلی ترین دلیل و هدفی که از اوپن کردن این سورس داشتم، افزایش دانش عمومی بوده و هست
و خوشحالم که میتونم با این کار به شما و دیگران کمک کنم،
و چه خوب میشه یاد بگیریم به هم دیگه کمک کنیم
و این فرهنگ (اوپن سورس بودن پروژه ها) رو توی کشور خودمون یعنی ایران جا بندازیم
و در حد توانمون قانون کپی رایت و حقوق ناشر رو رعایت کنیم.