Exemple #1
0
 /**
  * Erzeugt Thumbanils für Dateimanager
  * @param arraye $folderFiles
  */
 public function createFilemanagerThumbs($folderFiles = null)
 {
     $folderFiles = is_null($folderFiles) ? $this->getFolderList() : $folderFiles;
     include_once \fpcm\classes\loader::libGetFilePath('PHPImageWorkshop', 'ImageWorkshop.php');
     $filesizeLimit = \fpcm\classes\baseconfig::memoryLimit(true) * 0.025;
     $memoryWorkLimit = \fpcm\classes\baseconfig::memoryLimit(true) * 0.5;
     foreach ($folderFiles as $folderFile) {
         if (filesize($folderFile) >= $filesizeLimit) {
             $msgPath = ops::removeBaseDir($folderFile);
             \fpcm\classes\logs::syslogWrite("Skip filemanager thumbnail generation for {$msgPath} because of image dimension. You may reduce file size?");
             continue;
         }
         $phpImgWsp = \PHPImageWorkshop\ImageWorkshop::initFromPath($folderFile);
         $image = new \fpcm\model\files\image(basename($folderFile), '', '');
         if (file_exists($image->getFileManagerThumbnail())) {
             $image = null;
             $phpImgWsp = null;
             continue;
         }
         if (memory_get_usage(true) < $memoryWorkLimit) {
             $phpImgWsp->cropMaximumInPixel(0, 0, "MM");
         }
         $phpImgWsp->resizeInPixel(100, 100);
         $phpImgWsp->save(dirname($image->getFileManagerThumbnail()), basename($image->getFileManagerThumbnail()));
         if (!file_exists($image->getFileManagerThumbnail())) {
             trigger_error('Unable to create filemanager thumbnail: ' . $image->getFileManagerThumbnail());
         }
         $image = null;
         $phpImgWsp = null;
     }
 }
 /**
  * Liefert eine URL zum Aufrufend er Datei zurück
  * @return string
  */
 public function getFileUrl()
 {
     return \fpcm\classes\baseconfig::$rootPath . ltrim(ops::removeBaseDir($this->fullpath), '/');
 }