diff --git a/private/lib/dao/mediaModels/MediaModel.php b/private/lib/dao/mediaModels/MediaModel.php index d976af4..cc3446a 100644 --- a/private/lib/dao/mediaModels/MediaModel.php +++ b/private/lib/dao/mediaModels/MediaModel.php @@ -59,13 +59,13 @@ class MediaModel extends Model implements MediaInterface{ } } - public function asText(){ - return $this->mediaRenderer->asText(); + public function asText(array $opts = array()){ + return $this->mediaRenderer->asText($opts); } - public function renderMedia(){ + public function renderMedia(array $opts = array()){ // var_dump($this->mediaRenderer); - $this->mediaRenderer->render(); + $this->mediaRenderer->render($opts); } public function getType(){ diff --git a/private/lib/gui/FDN2Components.php b/private/lib/gui/FDN2Components.php index cbd9827..9b66701 100644 --- a/private/lib/gui/FDN2Components.php +++ b/private/lib/gui/FDN2Components.php @@ -15,7 +15,7 @@ class NotiziaBlock { $mainMedia = DaoMediaHandler::getMainMediaFromModel($this->notizia); $mediaText = ""; if (!is_null($mainMedia)){ - $mediaText = $mainMedia->asText(); + $mediaText = $mainMedia->asText(array("clickable"=>true)); } $rval = '
'; $rval.= '
'.$mediaText.'
'; diff --git a/private/lib/media/MediaRendererInterface.php b/private/lib/media/MediaRendererInterface.php index 9e1bcbb..f9767d2 100644 --- a/private/lib/media/MediaRendererInterface.php +++ b/private/lib/media/MediaRendererInterface.php @@ -1,6 +1,25 @@ code; + $size = MediaRendererInterface::SIZE_ORIGINAL; + $width = ''; + $height = ''; + if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES)){ + $size = $opt["size"]; + $width = 'height:'.self::$SIZES[$size]["width"].'px;'; + $height = 'width:'.self::$SIZES[$size]["height"].'px;'; + } + + return '
'.$this->code.'
'; } public function render(array $opt = array()){ diff --git a/private/lib/media/mediaRenderers/MediaImage.php b/private/lib/media/mediaRenderers/MediaImage.php index f8fe545..ffb9b0f 100644 --- a/private/lib/media/mediaRenderers/MediaImage.php +++ b/private/lib/media/mediaRenderers/MediaImage.php @@ -1,14 +1,16 @@ id = $id; } public function asText(array $opt = array()){ - $size = "small"; - if(sizeof($opt)>0 && array_key_exists("size", $opt)){ + $size = MediaRendererInterface::SIZE_ORIGINAL; + if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES)){ $size = $opt["size"]; } return ''; diff --git a/private/lib/media/mediaRenderers/MediaLocalVideo.php b/private/lib/media/mediaRenderers/MediaLocalVideo.php index 5434b0e..e3185aa 100644 --- a/private/lib/media/mediaRenderers/MediaLocalVideo.php +++ b/private/lib/media/mediaRenderers/MediaLocalVideo.php @@ -1,6 +1,6 @@ paths->media."/".$this->id.".pdf"; + $clickable = false; + if (array_key_exists("clickable", $opt)){ + $clickable = $opt["clickable"]; + } + if ($clickable){ + return ''; + } + else { + return ''; + } + +// return GlobalVariables::get("config")->paths->media."/".$this->id.".pdf"; } public function render(array $opt = array()){ diff --git a/private/lib/media/mediaRenderers/MediaRenderer.php b/private/lib/media/mediaRenderers/MediaRenderer.php new file mode 100644 index 0000000..897fe5a --- /dev/null +++ b/private/lib/media/mediaRenderers/MediaRenderer.php @@ -0,0 +1,16 @@ + array("width"=>MediaRendererInterface::SIZE_SMALL_W,"height"=>MediaRendererInterface::SIZE_SMALL_H), + MediaRendererInterface::SIZE_MEDIUM => array("width"=>MediaRendererInterface::SIZE_MEDIUM_W,"height"=>MediaRendererInterface::SIZE_MEDIUM_H), + MediaRendererInterface::SIZE_BIG => array("width"=>MediaRendererInterface::SIZE_BIG_W,"height"=>MediaRendererInterface::SIZE_BIG_H), + MediaRendererInterface::SIZE_ORIGINAL => array("width"=>MediaRendererInterface::SIZE_ORIGINAL_W,"height"=>MediaRendererInterface::SIZE_ORIGINAL_H) + ); +} + +?> \ No newline at end of file diff --git a/private/lib/media/mediaRenderers/MediaYoutube.php b/private/lib/media/mediaRenderers/MediaYoutube.php index 4434e99..1343afd 100644 --- a/private/lib/media/mediaRenderers/MediaYoutube.php +++ b/private/lib/media/mediaRenderers/MediaYoutube.php @@ -1,6 +1,6 @@ Tipo
- renderMedia(); ?> + renderMedia(array("size"=>MediaRenderer::SIZE_MEDIUM)); ?>
diff --git a/public/admin/homeMultimedia.php b/public/admin/homeMultimedia.php index 87a4a96..b407360 100644 --- a/public/admin/homeMultimedia.php +++ b/public/admin/homeMultimedia.php @@ -86,7 +86,7 @@ HTMLHelper::generateAdminHead(); 0){ foreach ($medias as $media){ if($media->id == $notizia->getMainMediaReference()){?> -
+
diff --git a/public/getImage.php b/public/getImage.php index 3484009..956687a 100644 --- a/public/getImage.php +++ b/public/getImage.php @@ -6,20 +6,15 @@ Creation Date: 14/gen/2016 require_once(dirname(__FILE__)."/load.php"); -$sizes = array( - "large"=>array("width"=>800,"height"=>600), - "small"=>array("width"=>160,"height"=>120) -); +// $sizes = array( +// "large"=>array("width"=>800,"height"=>600), +// "small"=>array("width"=>160,"height"=>120) +// ); if (array_key_exists("id",$_GET)) { - if (array_key_exists('size',$_GET)){ - $size=$_GET['size']; - } - else { - $size = "original"; - } - if (!array_key_exists($size, $sizes) || strcmp("original", $size)==0){ - $size = null; + $size = MediaImage::SIZE_ORIGINAL; + if (array_key_exists('size',$_GET) && array_key_exists(intval($_GET["size"]), MediaImage::$SIZES)){ + $size=intval($_GET['size']); } $img = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$_GET['id'])); @@ -32,12 +27,12 @@ if (array_key_exists("id",$_GET)) { $geom = $thumb->getimagegeometry(); if($img->extension != "gif"){ - if (!is_null($size)){ + if ($size!=MediaImage::SIZE_ORIGINAL){ if ($geom["width"]>=$geom["height"]){ - $thumb->scaleimage($sizes[$size]["width"], 0,false); + $thumb->scaleimage(MediaImage::$SIZES[$size]["width"], 0,false); } else { - $thumb->scaleimage(0, $sizes[$size]["height"],false); + $thumb->scaleimage(0, MediaImage::$SIZES[$size]["height"],false); } } @@ -47,13 +42,13 @@ if (array_key_exists("id",$_GET)) { else{ $thumb = $thumb->coalesceimages(); - if (!is_null($size)){ + if ($size!=MediaImage::SIZE_ORIGINAL){ foreach ($thumb as $frame){ if ($geom["width"]>=$geom["height"]){ - $thumb->scaleimage($sizes[$size]["width"], 0,false); + $thumb->scaleimage(MediaImage::$SIZES[$size]["width"], 0,false); } else { - $thumb->scaleimage(0, $sizes[$size]["height"],false); + $thumb->scaleimage(0, MediaImage::$SIZES[$size]["height"],false); } } } diff --git a/public/getPDF.php b/public/getPDF.php new file mode 100644 index 0000000..e1bf0c1 --- /dev/null +++ b/public/getPDF.php @@ -0,0 +1,27 @@ +getFirst("MediaModel",array("id"=>$_GET['id'])); + $id = $_GET["id"]; + if (!is_null($pdfModel)){ + $localFilePath = GlobalVariables::get("config")->paths->media."/".$id.".pdf"; + $exposedFilePath = GlobalVariables::get("config")->paths->xsendfile."/".$id.".pdf"; + if (!SFSManager::fileExists($exposedFilePath)){ + SystemController::shellExec("ln",'-s "'.$localFilePath.'" "'.$exposedFilePath.'"'); + } + header('X-Sendfile: '.$exposedFilePath.''); + + header("Content-type: application/octet-stream"); + header('Content-Disposition: attachment; filename="' . basename($exposedFilePath) . '"'); + } + +} + + +?> \ No newline at end of file diff --git a/public/style/admin.css b/public/style/admin.css index 83164be..41122c8 100644 --- a/public/style/admin.css +++ b/public/style/admin.css @@ -84,8 +84,9 @@ div.notiziaStat >div > div {text-align:center;} | | | | __/ (_| | | (_| | |_| |_|\___|\__,_|_|\__,_| -*/ -.mediaElement{display:inline-block; background-color:yellow;padding:15px;} +*/ +.mediaElement.mainElement{background-color:yellow;} +.mediaElement{display:inline-block; padding:15px;} .mediaElement.selected {opacity:0.4;background-color:orange;} /* diff --git a/public/style/public.css b/public/style/public.css index 5bb65ca..278216d 100644 --- a/public/style/public.css +++ b/public/style/public.css @@ -74,7 +74,8 @@ body{font-family:lato, arial;} .ansa{border:solid #d6d6d6 1px;border-left:0px;border-right:0px;border-top:0px;height:180px;} .ansa> div {display:inline-block;vertical-align:top;} -.ansaImage{display:inline-block;margin:15px 7px;width:150px;overflow:hidden;text-align:center;} +.ansaImage{display:inline-block;margin:15px 7px;width:150px; height:113px; overflow:hidden;text-align:center;} +.ansaImage > * {max-height:100%;max-width:100%;} .ansaNews{margin-top:2px;width:330px;cursor:pointer;} .ansaTitolo{font-weight:bold;font-size:20px;text-align:justify;} .ansaSottotitolo{font-size:17px;color:#767676;text-align:justify;}