37 lines
933 B
PHP
37 lines
933 B
PHP
<?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;
|
|
}
|
|
|
|
if ($demande->type === 'nhd') {
|
|
$image->resize(640, 360, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
return true;
|
|
}
|
|
|
|
if ($demande->type === 'thumb') {
|
|
$image->resize(160, 90, ZEBRA_IMAGE_CROP_TOPLEFT);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|