[Linpha-cvs] SF.net SVN: linpha: [4737] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-07-10 19:16:41
|
Revision: 4737 http://svn.sourceforge.net/linpha/?rev=4737&view=rev Author: bzrudi Date: 2007-07-10 12:16:37 -0700 (Tue, 10 Jul 2007) Log Message: ----------- Make use of exiftool for video width and height. As getID3 often fails it seems to be no problem. So getid3 is to be removed Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/modules/module.video.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/ChangeLog 2007-07-10 19:16:37 UTC (rev 4737) @@ -1,3 +1,8 @@ +2007-07-10 bzrudi + * Make use exiftool for video information, so we can remove getid3 completely. + I don't like to keep it just to get width and height. + * TODO: save width and height during video import, it's currently missing! + 2007-07-06 bzrudi * Bumped Exiftool to latest stable 6.90 (windows bin 6.92) * Make use of http_build_query() whenever we have more than three args! Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/index.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -70,6 +70,9 @@ case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; +default: + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + break; } -?> \ No newline at end of file +?> Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/sql/sql.data.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -38,6 +38,7 @@ 'sys_import_exif_autorot' => '1', 'sys_import_use_exiftool' => '0', 'sys_import_use_emb_thumb' => '0', + 'sys_import_exiftool_avail' => '0', 'sys_import_files_ignored' => 'Thumbs.db,ZbThumbnail.info,_vti_cnf,_derived,Picasa.ini,Cdlabel.alb', 'sys_import_fileext_ignored' => 'thm,doc,txt', Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step11_finish.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -136,9 +136,24 @@ } } } + +/** + * exiftool available value + */ + +if(isset($_POST['sys_import_exiftool_avail'])) +{ + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . + "SET option_value = '".LinSql::linAddslashes($_POST['sys_import_exiftool_avail'])."' " . + "WHERE option_name = 'sys_import_exiftool_avail'"); + if(!$result) + { + echo failed_msg(); + $error_nr = 1; + } +} - if(isset($error_nr)) { echo "</form>"; Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step2_requirements.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -226,7 +226,14 @@ } echo "\t".'<input type="hidden" name="sys_import_has_perl" value="'.$perl_ok.'">'."\n"; - // @TODO make perl path avail in config + + /** + * even if user decided to not make use of exiftool, we set + * sys_import_exiftool_avail = true , as we need it for video infos later + */ + echo "\t".'<input type="hidden" name="sys_import_exiftool_avail" value="'.$perl_ok.'">'; + + // @TODO make perl path avail in config //echo "\t".'<input type="hidden" name="sys_import_perl_path" value="'.$perl_path.'">'."\n"; } /** Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/install/step3_dbtype.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -34,7 +34,12 @@ $_SESSION['language'] = $_POST['language']; } -$array = array('sys_im_bracket_support','sys_im_use_convert','sys_im_convert_path','sys_import_has_perl'); +$array = array('sys_im_bracket_support', + 'sys_im_use_convert', + 'sys_im_convert_path', + 'sys_import_has_perl', + 'sys_import_exiftool_avail'); + foreach($array AS $value) { if(isset($_POST[$value])) Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -125,10 +125,11 @@ LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); - /*echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; + /* + echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; echo '<pre>', print_r($meta), '</pre>'; - exit();*/ - + exit(); + */ /** * Create usable array information by cycling and splitting * all information Modified: trunk/linpha2/lib/modules/module.video.php =================================================================== --- trunk/linpha2/lib/modules/module.video.php 2007-07-10 09:43:45 UTC (rev 4736) +++ trunk/linpha2/lib/modules/module.video.php 2007-07-10 19:16:37 UTC (rev 4737) @@ -1,227 +1,236 @@ -<?php -/* - * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> - * Florian Angehrn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/** - * Video - * @package Modules - * @todo use unified error messages - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -if( $linpha->template->idCurrent == 0 ) -{ - echo i18n("No valid id supplied!"); - exit(1); -} - -$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); - -/** - * check for valid filename - */ -if( $fullfilename === FALSE OR !file_exists($fullfilename) ) -{ - echo i18n("No valid id supplied!"); - exit(1); -} - -/** - * get file informations - */ -$data = $GLOBALS['linpha']->db->GetRow("SELECT img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); - -$img_type = $data['img_type']; -$filename = basename($fullfilename); - - -/** - * check file permissions - */ -if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) -{ - echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); - exit(1); -} - -if( !LinIdentify::isVideo($img_type) ) -{ - echo i18n("This is not a video!"); - exit(1); -} - -/** - * statistics - * count video views - */ - /** - * @todo - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); - - include_once(TOP_DIR.'/plugins/stats/stats.class.php'); - linStats('download',$md5sum); - */ - -/** - * get width and height of video - */ - include_once(LINPHA_DIR.'/lib/classes/getid3/getid3.php'); - define('GETID3_HELPERAPPSDIR', LINPHA_DIR); // needs to be set to a valid dir, otherwise it doesn't work under windows - $getID3 = new getID3; - $file_info = $getID3->analyze($fullfilename); - - if( isset($file_info['video']['resolution_x']) AND $file_info['video']['resolution_x'] != 0) - { - $file_width = $file_info['video']['resolution_x']; - } - - if( isset($file_info['video']['resolution_y']) AND $file_info['video']['resolution_y'] != 0) - { - $file_height = $file_info['video']['resolution_y']; - } - - - - - -ob_start(); - - /* - http://www.public.iastate.edu/~rdalhoff/embedvideo.html - - Real Video - <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" - HEIGHT="160" WIDTH="220"> - <PARAM NAME="SRC" - VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> - <PARAM NAME="CONTROLS" VALUE="ImageWindow"> - <PARAM NAME="CONSOLE" VALUE="video1"> - <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" - width="220" height="160" controls="ImageWindow" - nojava="true" center="true" console="Carol1"> - </embed> - </OBJECT> - <br> - <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" - HEIGHT="100" WIDTH="220"> - <PARAM NAME="SRC" VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> - <PARAM NAME="CONTROLS" VALUE="all"> - <PARAM NAME="CONSOLE" VALUE="video1"> - <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" - width="220" height="100" nojava="true" controls="All" console="Carol1"> - - </embed> - </OBJECT> - - Quicktime - <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" - codebase="http://www.apple.com/qtactivex/qtplugin.cab" - width="240" height="180"> - <param name="src" value="carol6-ref.mov"> - <param name="loop" value="false"> - <param name="autoplay" value="false"> - <param name="controller" value="true"> - <embed - height="180" - width="240" - src="carol6-ref.mov" - name="Get QuickTime" - loop="false" - cache="true" - controller="true" autoplay="false" - pluginspage="http://www.apple.com/quicktime/download/"> - </embed> - </object> - - - Old Linpha1 (quicktime) - <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="<?php echo $this->stage_height; ?>" width="<?php echo $this->stage_width; ?>"> - <param name="bgcolor" value="#a3a3a3"> - <param name="src" value="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>"> - <param name="autoplay" value="false"> - <param name="controller" value="true"> - <embed - height="<?php echo $this->stage_height; ?>" - width="<?php echo $this->stage_width; ?>" - pluginspage="http://www.apple.com/quicktime/download/" - src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>" - type="video/quicktime" - controller="true" - autoplay="false"> - </object> - - New Linpha1 (mediaplayer, new version can also play quicktime files) - <embed type="application/x-mplayer2" - src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']."&ignore=true"; ?>" - width="<?php echo $this->stage_width; ?>" - height="<?php echo ($this->stage_height + 45); ?>" - transparentatstart="true" - autostart="true" - animationatstart="true" - showcontrols="true" - showaudiocontrols="true" - showpositioncontrols="true" - autosize="false" - showstatusbar="true" - displaysize="true" - hspace="4"> - </embed> - - Somewhere found (does not work in firefox unless we add type="application/x-mplayer2") - <embed - src="7.wmv" - width=400 - height=369 - autoplay=true - controller=true - loop=false - showstatusbar=true> - </embed> - */ -?> -<div style="text-align: center;"> - <h2 class="linStyle"><?php - $array_path = LinSql::getFullFilenameFromId( $linpha->template->idCurrent ); - echo implode(' / ',$array_path); - ?></h3> - <embed type="application/x-mplayer2" src="<?php echo LINPHA_LINK.'linCat=download&linId='.$linpha->template->idCurrent; ?>" - width="<?php echo $file_width; ?>" height="<?php echo ($file_height+45); ?>" - autoplay="true" controller="true" loop="false" showstatusbar="false"> - </embed> - <br /> - <a href="javascript:window.close()"><?php echo i18n("Close"); ?></a> - <?php - echo '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$linpha->template->idCurrent.'&isDownload=true">'.i18n("Download").'</a>'; - ?> -</div> - -<?php -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); -//$linpha->template->overrideModule('css','filemanager'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=video&linId='.$linpha->template->idCurrent; -$linpha->template->hideMenu = true; -$linpha->template->hideTitle = true; -$linpha->template->output['title'] = i18n("Video"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); -?> +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Video + * @package Modules + * @todo use unified error messages + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +if( $linpha->template->idCurrent == 0 ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); + +/** + * check for valid filename + */ +if( $fullfilename === FALSE OR !file_exists($fullfilename) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +/** + * get file informations + */ +$data = $GLOBALS['linpha']->db->GetRow("SELECT img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check file permissions + */ +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); + exit(1); +} + +if( !LinIdentify::isVideo($img_type) ) +{ + echo i18n("This is not a video!"); + exit(1); +} + +/** + * statistics + * count video views + */ + /** + * @todo + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); + + include_once(TOP_DIR.'/plugins/stats/stats.class.php'); + linStats('download',$md5sum); + */ + +/** + * get width and height of video + */ +if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) +{ + include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); + + $exiftool = new LinExifTool; + + $file_info = $exiftool->readMetaDataFromFile("all",$fullfilename); + + if( isset($file_info['ImageWidth']) AND $file_info['ImageWidth'] != 0) + { + $file_width = $file_info['ImageWidth']; + } + + if( isset($file_info['ImageHeight']) AND $file_info['ImageHeight'] != 0) + { + $file_height = $file_info['ImageHeight']; + } +} +else +{ + /** + * Just Hardcode width and height if exiftool not avail, + * better than no result and should work. + */ + $file_width = "320"; + $file_height = "240"; +} + +ob_start(); + + /* + http://www.public.iastate.edu/~rdalhoff/embedvideo.html + + Real Video + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="160" WIDTH="220"> + <PARAM NAME="SRC" + VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="ImageWindow"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="160" controls="ImageWindow" + nojava="true" center="true" console="Carol1"> + </embed> + </OBJECT> + <br> + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="100" WIDTH="220"> + <PARAM NAME="SRC" VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="all"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="100" nojava="true" controls="All" console="Carol1"> + + </embed> + </OBJECT> + + Quicktime + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" + codebase="http://www.apple.com/qtactivex/qtplugin.cab" + width="240" height="180"> + <param name="src" value="carol6-ref.mov"> + <param name="loop" value="false"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="180" + width="240" + src="carol6-ref.mov" + name="Get QuickTime" + loop="false" + cache="true" + controller="true" autoplay="false" + pluginspage="http://www.apple.com/quicktime/download/"> + </embed> + </object> + + + Old Linpha1 (quicktime) + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="<?php echo $this->stage_height; ?>" width="<?php echo $this->stage_width; ?>"> + <param name="bgcolor" value="#a3a3a3"> + <param name="src" value="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="<?php echo $this->stage_height; ?>" + width="<?php echo $this->stage_width; ?>" + pluginspage="http://www.apple.com/quicktime/download/" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>" + type="video/quicktime" + controller="true" + autoplay="false"> + </object> + + New Linpha1 (mediaplayer, new version can also play quicktime files) + <embed type="application/x-mplayer2" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']."&ignore=true"; ?>" + width="<?php echo $this->stage_width; ?>" + height="<?php echo ($this->stage_height + 45); ?>" + transparentatstart="true" + autostart="true" + animationatstart="true" + showcontrols="true" + showaudiocontrols="true" + showpositioncontrols="true" + autosize="false" + showstatusbar="true" + displaysize="true" + hspace="4"> + </embed> + + Somewhere found (does not work in firefox unless we add type="application/x-mplayer2") + <embed + src="7.wmv" + width=400 + height=369 + autoplay=true + controller=true + loop=false + showstatusbar=true> + </embed> + */ +?> +<div style="text-align: center;"> + <h2 class="linStyle"><?php + $array_path = LinSql::getFullFilenameFromId( $linpha->template->idCurrent ); + echo implode(' / ',$array_path); + ?></h2> + <embed type="application/x-mplayer2" src="<?php echo LINPHA_LINK.'linCat=download&linId='.$linpha->template->idCurrent; ?>" + width="<?php echo $file_width; ?>" height="<?php echo ($file_height+45); ?>" + autoplay="true" controller="true" loop="false" showstatusbar="false"> + </embed> + <br /> + <a href="javascript:window.close()"><?php echo i18n("Close"); ?></a> + <?php + echo '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$linpha->template->idCurrent.'&isDownload=true">'.i18n("Download").'</a>'; + ?> +</div> + +<?php +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +//$linpha->template->overrideModule('css','filemanager'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=video&linId='.$linpha->template->idCurrent; +$linpha->template->hideMenu = true; +$linpha->template->hideTitle = true; +$linpha->template->output['title'] = i18n("Video"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |