resize img to 224x224
This commit is contained in:
parent
9cca411720
commit
999df32e09
|
@ -381,7 +381,18 @@ class ListManagementController extends Controller {
|
|||
$fileName = "face_" . $key . "_" . time() . ".png";
|
||||
$img = file_get_contents($value);
|
||||
if ($img !== "null") {
|
||||
file_put_contents($targetPath . "/" . $fileName, $img);
|
||||
$im = imagecreatefromstring($img);
|
||||
$width = imagesx($im);
|
||||
$height = imagesy($im);
|
||||
$newwidth = 224;
|
||||
$newheight = 224;
|
||||
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
imagejpeg($thumb, $fileTarget);
|
||||
imagedestroy($thumb);
|
||||
imagedestroy($im);
|
||||
// file_put_contents($fileTarget, $img);
|
||||
$features = json_decode(common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user