attr_name . '">
(макс.: '.ini_get('upload_max_filesize').')'; $html .= ''; if ( $this->getCurVal() ) { $html .= '
'; } return $html; } function lPost() { $tmpObj = new cobject( '_sys_files' ); $file = $_FILES[$this->attr_name]; $nn = md5(microtime(true)); if ($_POST[$this->attr_name . '_del']) { $this->obj->set( $this->attr_name, 0 ); } if (!$file['error']) { $arr = explode('/', $file['type'] ); if ($arr[0] == 'video' || $arr[0] == 'application') { if ( move_uploaded_file( $file['tmp_name'], _FILES_DIR_.$nn ) ) { $tmpObj->set('filename', $nn ); $tmpObj->set('realname', $file['name'] ); $tmpObj->set('ext', $file['type'] ); $tmpObj->save(); $this->obj->set( $this->attr_name, $tmpObj->id ); symlink( _FILES_DIR_.$nn , _VIDEO_DIR_ . $tmpObj->id . '.flv'); if ( isset($this->obj->attrs[$this->attr_name.'_preview']) ) { $str = "ffmpeg -i "._FILES_DIR_.$nn. " -an -ss 00:00:05 -an -r 1 -vframes 1 -y -f image2 -s ".$this->obj->attrs[$this->attr_name.'_preview']['templ']." " ._FILES_DIR_.$nn . "_pre.jpg"; system($str); copy( _FILES_DIR_.$nn.'_pre.jpg' , _FILES_DIR_.$nn.'_pre' ); unlink( _FILES_DIR_.$nn.'_pre.jpg' ); $tmpObj->byId(0); $tmpObj->set('filename', $nn.'_pre' ); $tmpObj->set('realname', $file['name'].'.jpg' ); $tmpObj->set('ext', 'image/jpeg' ); $tmpObj->save(); $this->obj->set($this->attr_name.'_preview', $tmpObj->id ); } if ( isset($this->obj->attrs[$this->attr_name.'_full_preview']) ) { $str = "ffmpeg -i "._FILES_DIR_.$nn. " -an -ss 00:00:05 -an -r 1 -vframes 1 -y -f image2 -s ".$this->obj->attrs[$this->attr_name.'_full_preview']['templ']." " ._FILES_DIR_.$nn . "_pre.jpg"; system($str); copy( _FILES_DIR_.$nn.'_pre.jpg' , _FILES_DIR_.$nn.'_full_preview' ); unlink( _FILES_DIR_.$nn.'_pre.jpg' ); $tmpObj->byId(0); $tmpObj->set('filename', $nn.'_full_preview' ); $tmpObj->set('realname', $file['name'].'.jpg' ); $tmpObj->set('ext', 'image/jpeg' ); $tmpObj->save(); $this->obj->set($this->attr_name.'_full_preview', $tmpObj->id ); } } } } } function render_text( $crop = false ) { if ($crop) { $val = 'Скачать'; } else { if (!$this->getCurVal()) return ''; return $this->getCurVal(); } return $val; } } ?>