2023-06-21 11:42:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Utils;
|
|
|
|
|
|
|
|
use Zebra_Image;
|
|
|
|
|
|
|
|
class ResizeToDemande {
|
|
|
|
|
|
|
|
static function makeDemande($demande) {
|
|
|
|
$image = new Zebra_Image();
|
|
|
|
$image->source_path = $demande->complete;
|
|
|
|
$image->target_path = $demande->filePath;
|
|
|
|
$image->preserve_time = false;
|
|
|
|
$image->enlarge_smaller_images = false;
|
|
|
|
|
|
|
|
if ($demande->type === 'full') {
|
|
|
|
$image->resize(1920, 1080, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($demande->type === 'hd') {
|
|
|
|
$image->resize(1280, 720, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-03-15 12:17:10 +01:00
|
|
|
if ($demande->type === 'nhd') {
|
|
|
|
$image->resize(640, 360, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-06-21 11:42:36 +02:00
|
|
|
if ($demande->type === 'thumb') {
|
|
|
|
$image->resize(160, 90, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|