Ejemplo n.º 1
0
 /**
  * @param $model
  * @param array $sizes
  * @param $original
  * @param $destination
  * @param $name
  */
 protected function addSizes($model, array $sizes, $original, $destination, $name)
 {
     foreach ($sizes as $size) {
         $path = $destination . $size . '/' . $name;
         $info = getimagesize($path);
         $this->repository->createThumbnailImage(['filename' => $name, 'width' => $info[0], 'height' => $info[1], 'extension' => pathinfo($path, PATHINFO_EXTENSION), 'path' => $this->mediaConfig->getAbstractPath($model, 'images', $size) . $name], $original);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param Filesystem $files
  * @param Configurator $config
  */
 protected function handleFile(Filesystem $files, Configurator $config)
 {
     $abstract = $config->getAbstractPath($this->owner, 'images');
     $public = $config->getPublicPath($this->owner, 'images');
     if (!$files->isDirectory($public)) {
         $files->makeDirectory($public, 0755, true);
     }
     //abstract path to actual file
     $path = $abstract . $this->rename;
     //always copy the file first
     $files->copy($this->currentPath, public_path($path));
     $this->path = $path;
 }