2019-12-05 13:11:18 +00:00
|
|
|
<?php
|
2019-12-05 17:52:48 +00:00
|
|
|
|
|
|
|
#echo "TODO: create thumbnail for ".$_GET["id"]." here";
|
|
|
|
|
|
|
|
$width = 100;
|
|
|
|
$height = 100;
|
|
|
|
$quality = 90;
|
|
|
|
|
|
|
|
$thumb = getcwd() . $_GET["id"];
|
|
|
|
$img = str_replace("thumbnails", "staticimages", $thumb);
|
|
|
|
if (is_file($img)) {
|
|
|
|
$imagick = new Imagick($img);
|
|
|
|
$imagick->setImageFormat('jpeg');
|
|
|
|
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
|
|
|
|
$imagick->setImageCompressionQuality($quality);
|
|
|
|
$imagick->cropThumbnailImage($width, $height);
|
|
|
|
$imagick->setImagePage(0, 0, 0, 0);
|
|
|
|
if (file_put_contents($thumb, $imagick) === false) {
|
|
|
|
throw new Exception("Could not put contents.");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
throw new Exception("No valid image provided with {$img}.");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-05 13:11:18 +00:00
|
|
|
?>
|