Lower resolution image preview

This commit is contained in:
Michał Gdula 2022-09-09 15:37:34 +00:00
parent 3847020ae7
commit 41d98a7d47
8 changed files with 190 additions and 84 deletions

View file

@ -0,0 +1,20 @@
<?php
/*
|-------------------------------------------------------------
| Create Thumbnails
|-------------------------------------------------------------
| Default resolution for a preview image is 300px (max-width)
| ** Not yet implemented **
|-------------------------------------------------------------
*/
function make_thumbnail($image_path, $thumbnail_path, $resolution) {
try {
$thumbnail = new Imagick($image_path);
$thumbnail->resizeImage($resolution,null,null,1,null);
$thumbnail->writeImage($thumbnail_path);
return "success";
} catch (Exception $e) {
return $e;
}
}