Пример #1
0
 /**
  * Create all thumbnails for the given image path
  * @param string $path
  */
 public function createAll($path)
 {
     if (!$this->isImage($path)) {
         return;
     }
     foreach ($this->manager->all() as $thumbnail) {
         $image = $this->image->make($this->filesystem->disk($this->getConfiguredFilesystem())->get($this->getDestinationPath($path->getRelativeUrl())));
         if (is_module_enabled('Site')) {
             $filename = config('asgard.media.config.files-path') . Site::current()->slug . '/' . $this->newFilename($path, $thumbnail->name());
         } else {
             $filename = config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail->name());
         }
         foreach ($thumbnail->filters() as $manipulation => $options) {
             $image = $this->imageFactory->make($manipulation)->handle($image, $options);
         }
         $image = $image->stream(pathinfo($path, PATHINFO_EXTENSION));
         $this->writeImage($filename, $image);
     }
 }