Exemple #1
0
 public static function getThumbnail($fileName, $dimension)
 {
     $PathInfo = pathinfo($fileName);
     $thumbnailName = str_replace(' ', '_', "{$PathInfo['dirname']}/{$PathInfo['filename']}.thu{$Dim[0]}.{$PathInfo['extension']}");
     $thumbnailName = str_replace('_(Custom)', '', $thumbnailName);
     if (!is_file($_SERVER['DOCUMENT_ROOT'] . $thumbnailName)) {
         //Effettuo il resize delle immagini al fine di creare le thumbneil
         //$thumb = PhpThumbFactory::create($_SERVER['DOCUMENT_ROOT'].$fileName);
         //$thumb->adaptiveResize($Dim[0], $Dim[1])->save($_SERVER['DOCUMENT_ROOT'].$ThuNam);
         $thumb = Image::make($_SERVER['DOCUMENT_ROOT'] . $fileName);
         $thumb->resize($dimension[0], $dimension[1]);
         $thumb->save($_SERVER['DOCUMENT_ROOT'] . $thumbnailName);
     }
     return $thumbnailName;
 }