Ejemplo n.º 1
0
 /**
  * Returns the information we could find on the file
  * @return Array
  */
 public function getFileinfo()
 {
     $toret = parent::getFileinfo();
     // get the ID3 data if it is an MP3
     if ($this->extension == 'MP3') {
         if (function_exists('id3_get_tag')) {
             try {
                 $id3sata = id3_get_tag($this->fullpath);
                 foreach ($id3sata as $key => $val) {
                     if ($key == 'genre') {
                         $toret['mp3.' . $key] = id3_get_genre_name($val);
                     } else {
                         $toret['mp3.' . $key] = $val;
                     }
                 }
             } catch (Exception $e) {
             }
         }
     }
     return $toret;
 }
Ejemplo n.º 2
0
 /**
  * Returns the information we could find on the file
  * @return Array
  */
 public function getFileinfo()
 {
     if ($this->fileinfos == null) {
         $toret = parent::getFileinfo();
         // get the exif data
         try {
             /*
             $cls=new ReflectionClass('ffmpeg_movie');
             print '<xmp>';
             foreach($cls->getMethods() as $n) print '$toret[\'video.'.$n->name.'\'] = $movie->'.$n->name."();\n";
             print '</xmp>';
             */
             $movie = new ffmpeg_movie($this->fullpath, false);
             $toret['video.duration'] = $movie->getduration();
             $toret['video.framecount'] = $movie->getframecount();
             $toret['video.framerate'] = $movie->getframerate();
             $toret['video.filename'] = $movie->getfilename();
             $toret['video.comment'] = $movie->getcomment();
             $toret['video.title'] = $movie->gettitle();
             $toret['video.author'] = $movie->getauthor();
             $toret['video.artist'] = $movie->getartist();
             $toret['video.copyright'] = $movie->getcopyright();
             $toret['video.album'] = $movie->getalbum();
             $toret['video.genre'] = $movie->getgenre();
             $toret['video.year'] = $movie->getyear();
             $toret['video.tracknumber'] = $movie->gettracknumber();
             $toret['video.framewidth'] = $movie->getframewidth();
             $toret['video.frameheight'] = $movie->getframeheight();
             $toret['video.framenumber'] = $movie->getframenumber();
             $toret['video.pixelformat'] = $movie->getpixelformat();
             $toret['video.bitrate'] = $movie->getbitrate();
             $toret['video.hasaudio'] = $movie->hasaudio();
             $toret['video.hasvideo'] = $movie->hasvideo();
             $toret['video.videocodec'] = $movie->getvideocodec();
             $toret['video.audiocodec'] = $movie->getaudiocodec();
             $toret['video.videostreamid'] = $movie->getvideostreamid();
             $toret['video.audiostreamid'] = $movie->getaudiostreamid();
             $toret['video.audiochannels'] = $movie->getaudiochannels();
             $toret['video.audiosamplerate'] = $movie->getaudiosamplerate();
             $toret['video.audiobitrate'] = $movie->getaudiobitrate();
             $toret['video.videobitrate'] = $movie->getvideobitrate();
             $toret['video.pixelaspectratio'] = $movie->getpixelaspectratio();
             foreach ($toret as $k => $v) {
                 if ($v == '') {
                     unset($toret[$k]);
                 }
             }
             //$frm = $movie->getFrame(1);
         } catch (Exception $e) {
         }
         $this->fileinfos = $toret;
         return $this->fileinfos;
     } else {
         return $this->fileinfos;
     }
 }
Ejemplo n.º 3
0
 public function getSize()
 {
     return parent::getSize();
 }
Ejemplo n.º 4
0
 /**
  * Returns the information we could find on the file
  * @return Array
  */
 public function getFileinfo()
 {
     $toret = parent::getFileinfo();
     // add the image size to the array
     $is = $this->getSize();
     $toret['img.width'] = $is[0];
     $toret['img.height'] = $is[1];
     // get the exif data
     try {
         $ft = @exif_imagetype($this->fullpath);
         if ($ft != IMAGETYPE_GIF && $ft != IMAGETYPE_PNG) {
             try {
                 ini_set("display_errors", 0);
                 $exifh = exif_read_data($this->fullpath);
                 if ($exifh) {
                     $exif = exif_read_data($this->fullpath, 0, true);
                     foreach ($exif as $key => $section) {
                         foreach ($section as $name => $val) {
                             $toret['img.' . $key . '.' . $name] = $val;
                         }
                     }
                     unset($toret['img.EXIF.MakerNote']);
                     unset($toret['img.EXIF.UserComment']);
                 }
             } catch (Exception $e) {
             }
         }
     } catch (Exception $e) {
     }
     return $toret;
 }
Ejemplo n.º 5
0
 /**
  * Displays the thumbnail on the STDOUT
  * @return Boolean
  */
 public function showThumb()
 {
     return parent::showThumb();
 }
Ejemplo n.º 6
0
 /**
  * @param int $dw
  * @param bool $pdfLogo
  * @param int $pdfLogoSize
  */
 public function showImg($dw = 500, $pdfLogo = false, $pdfLogoSize = 128)
 {
     $cachename = $this->fullpath . $dw . $this->pageid . ".png";
     $cacheimg = $this->cachepath . '/' . $this->_nameFilter($cachename);
     if (class_exists('Imagick')) {
         try {
             $im = $this->_dataCacher($cachename);
             if ($im === false) {
                 $this->_logToFile('File not in cache');
                 $im = new imagick($this->fullpath . '[' . $this->pageid . ']');
                 //$im->setSize($dw*2,$dw*2);
                 $im->setImageFormat("png");
                 $im->adaptiveResizeImage($dw, $dw, true);
                 // add a border to the image
                 $color = new ImagickPixel();
                 $color->setColor("rgb(200,200,200)");
                 $im->borderImage($color, 1, 1);
                 // draw the PDF icon on top of the PDF preview
                 if ($pdfLogo) {
                     $pdflogo = new Imagick($this->assetsPath . $this->deficon);
                     $pdflogo->adaptiveResizeImage($pdfLogoSize, $pdfLogoSize);
                     $im->compositeImage($pdflogo, Imagick::COMPOSITE_DEFAULT, 1, 1);
                 }
                 $this->_dataCacher($cachename, $im);
                 $im->writeImage($cacheimg);
             } else {
                 $this->_logToFile('File IS cached');
             }
             header("Content-Type: image/png");
             header("Content-Disposition: attachment; filename=\"" . $cachename . ".png\";");
             $this->getRawFile($cacheimg, false, 'PNG', true);
         } catch (Exception $e) {
             return parent::showImg($dw);
         }
     } else {
         return parent::showImg($dw);
     }
 }