/** * Generate the thumbnail based on the local file system. This step is necessary * to simplify things and ensure the correct file permissions are given * to the local files. */ protected function makeThumbLocal($thumbFile, $thumbPath, $width, $height, $options) { $rootPath = $this->getLocalRootPath(); $filePath = $rootPath . '/' . $this->getDiskPath(); $thumbPath = $rootPath . '/' . $thumbPath; /* * Handle a broken source image */ if (!$this->hasFile($this->disk_name)) { BrokenImage::copyTo($thumbPath); } else { $resizer = Resizer::open($filePath); $resizer->resize($width, $height, $options['mode'], $options['offset']); $resizer->save($thumbPath, $options['quality']); } FileHelper::chmod($thumbPath); }
/** * Generate the thumbnail based on the local file system. This step is necessary * to simplify things and ensure the correct file permissions are given * to the local files. */ protected function makeThumbLocal($thumbFile, $thumbPath, $width, $height, $options) { $rootPath = $this->getLocalRootPath(); $filePath = $rootPath . '/' . $this->getDiskPath(); $thumbPath = $rootPath . '/' . $thumbPath; /* * Handle a broken source image */ if (!$this->hasFile($this->disk_name)) { BrokenImage::copyTo($thumbPath); } else { try { Resizer::open($filePath)->resize($width, $height, $options)->save($thumbPath); } catch (Exception $ex) { BrokenImage::copyTo($thumbPath); } } FileHelper::chmod($thumbPath); }