Ejemplo n.º 1
0
 /**
  *
  * @return Sydney_Medias_Filetypes_Abstract
  * @param string $fullpath
  * @param Zend_Db_Table_Row $fdb The optional row from the DB
  * @return bool
  */
 public static function createfiletype($fullpath, $fdb = null)
 {
     $pi = pathinfo($fullpath);
     $ext = strtoupper($pi['extension']);
     $ft = Sydney_Medias_Utils::getFileType($ext);
     if (!file_exists($fullpath)) {
         $ft = Sydney_Medias_Utils::getFileType('unavailable');
     }
     if ($ft) {
         try {
             $fullpath = preg_replace("/\\/\\//", "/", $fullpath);
             $clsname = 'Sydney_Medias_Filetypes_' . ucfirst($ft[0]);
             return new $clsname($fullpath, null, $fdb);
         } catch (Exception $e) {
             self::$errors[] = 'Type Class can not be instanciated. I guess it does not exist.';
             return false;
         }
     } else {
         self::$errors[] = 'The file type is not supported.';
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the information we could find on the file
  * @return array
  */
 public function getFileinfo()
 {
     $ftinf = Sydney_Medias_Utils::getFileType($this->extension);
     $toret = array();
     $toret['general.deficon'] = $this->deficon;
     $toret['general.fullpath'] = $this->fullpath;
     if (file_exists($this->fullpath)) {
         $toret['general.filesize'] = filesize($this->fullpath);
         $toret['general.filemtime'] = filemtime($this->fullpath);
         $toret['general.filetype'] = filetype($this->fullpath);
     } else {
         $toret['general.filesize'] = 0;
         $toret['general.filemtime'] = null;
         $toret['general.filetype'] = null;
     }
     $toret['general.dirname'] = $this->dirname;
     $toret['general.basename'] = $this->basename;
     $toret['general.extension'] = $this->extension;
     $toret['general.intdesc'] = $ftinf[1];
     $toret['general.filename'] = $this->filename;
     $toret['general.assetsPath'] = $this->assetsPath;
     return $toret;
 }