54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 14/gen/2016
|
|
*/
|
|
|
|
require_once(dirname(__FILE__)."/load.php");
|
|
|
|
if (array_key_exists("id",$_GET)) {
|
|
if (array_key_exists('size',$_GET)){
|
|
$size=$_GET['size'];
|
|
}
|
|
else {
|
|
$size = "small";
|
|
}
|
|
|
|
$img = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$_GET['id']));
|
|
|
|
if (!is_null($img)){
|
|
$basepath = GlobalVariables::get("config")->paths->media;
|
|
$thumb = new Imagick($basepath."/".$img->id.".".$img->extension);
|
|
|
|
if ($size == "small"){
|
|
$thumb->thumbnailimage(0, 100);
|
|
}
|
|
|
|
header('Content-type: image/png');
|
|
echo $thumb;
|
|
|
|
|
|
// switch ($size){
|
|
// case "big":
|
|
// $img = ThumbnailGenerator::renderBigThumbnail($content);
|
|
// break;
|
|
// case "med":
|
|
// $img = ThumbnailGenerator::renderMediumThumbnail($content);
|
|
// break;
|
|
// case "small":
|
|
// $img = ThumbnailGenerator::renderSmallThumbnail($content);
|
|
// break;
|
|
// case "mini":
|
|
// $img = ThumbnailGenerator::renderMiniThumbnail($content);
|
|
// break;
|
|
// case "topbar":
|
|
// header("Cache-Control: no-cache, must-revalidate");
|
|
// $img = ThumbnailGenerator::renderThumbnail($content,150,0);
|
|
// break;
|
|
// default:
|
|
// $img = ThumbnailGenerator::renderOriginal($content);
|
|
// break;
|
|
// }
|
|
}
|
|
}
|
|
?>
|