Soshot/app/Utils/ResizeToDemande.php

33 lines
822 B
PHP

<?php
namespace App\Utils;
use Zebra_Image;
class ResizeToDemande {
static function makeDemande($demande) {
// todo add 640 360
$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 === 'thumb') {
$image->resize(160, 90, ZEBRA_IMAGE_CROP_TOPLEFT);
return true;
}
return false;
}
}