Ejemplo n.º 1
0
 public function get(RootFile $file)
 {
     if (!file_exists($file->getPathname())) {
         return ['error' => 'S0001'];
     }
     if ($file->isImage()) {
         $thumbName = $file->generateEditionFilename("thumbnail");
         $thumbPath = sprintf('%s/%s', $file->getPath(), $thumbName);
         if (!file_exists($thumbPath)) {
             return ['error' => 'S0002'];
         }
         $edition = new Edition("thumbnail", $thumbPath, $file->getUploaderPath(), ['type' => 'image'], true);
         $edition->setUrl($this->resolveUrl($edition));
         $file->addEdition($edition);
     }
     return $file;
 }