Esempio n. 1
0
 public function generatePreviewImage()
 {
     $url = Environment::getHttpRequest()->getUrl()->getHostUrl() . $this->downloadLink();
     //absolute URL
     $preview = self::getGoogleViewerPreview($url);
     if ($preview) {
         file_put_contents($this->getPreviewPath(), $preview['image']);
         $info = ImageFile::getImageInfo($this->getPreviewPath());
         //TODO rozmyslet kam metodu umístit
         $this->data['info'] = str_pad($preview['numPages'], 5) . $preview['text'];
         $this->data['dimensions'] = $info["wxh"];
         $this->save();
     }
 }
Esempio n. 2
0
 public static function uploadPreview($r)
 {
     $file = self::getFile($r['id']);
     //instance of File (or the specific file type)
     $r['file']->move($file->getPreviewPath());
     //move preview to its location
     $info = ImageFile::getImageInfo($file->getPreviewPath());
     $file->data['dimensions'] = $info["wxh"];
     $file->save();
     $file->clearPreviewCache();
 }