aggiunto metodo per salvare i media con file associato
correzioni varie al dao/model quando usano campo id/_id
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user