[Linpha-cvs] SF.net SVN: linpha: [4667] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-12-28 16:26:17
|
Revision: 4667 http://svn.sourceforge.net/linpha/?rev=4667&view=rev Author: fangehrn Date: 2006-12-28 08:26:12 -0800 (Thu, 28 Dec 2006) Log Message: ----------- 2006-12-28 flo * added video support * added panorama detection (view does not yet work) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/modules/module.download.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.panorama.php trunk/linpha2/lib/modules/module.video.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/ChangeLog 2006-12-28 16:26:12 UTC (rev 4667) @@ -1,4 +1,8 @@ +2006-12-28 flo + * added video support + * added panorama detection (view does not yet work) + 2006-12-22 flo * added download feature (without watermark and statistics) Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/index.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -58,6 +58,12 @@ case 'exif': require_once(LINPHA_DIR.'/lib/include/File_Info_Show.php'); break; +case 'video': + require_once(LINPHA_DIR.'/lib/modules/module.video.php'); + break; +case 'panorama': + require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); + break; case 'download': require_once(LINPHA_DIR.'/lib/modules/module.download.php'); break; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -529,7 +529,7 @@ * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm * thumbnail, image * meta_iptc - * download_noperm + * accessdenied * * * @param string $type log types Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -28,6 +28,7 @@ public $layoutimagespath; public $output; public $URL_base, $URL_full, $idCurrent; + public $hideMenu = false, $hideTitle = false; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; @@ -112,10 +113,10 @@ #menu ul { width: 1em; } /* this will be a *min* width */ #menu ul ul { width: 12em; } #menu ul li { float: left; width: 100%; } - </style> +<?php /* </style> <![endif]--> <!--[if lt IE 7]> - <style type="text/css" media="screen"> + <style type="text/css" media="screen">*/ ?> body { behavior: url(<?php echo LINPHA_CLIENT; ?>/templates/misc/csshover.htc); font-size: 100%; } #menu ul li a { height: 1%; } #menu a, #menu span { font: bold 0.7em/1.4em arial, helvetica, sans-serif; } Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/js/LinImage.js 2006-12-28 16:26:12 UTC (rev 4667) @@ -315,6 +315,16 @@ /*Element.setHeight('prevLink', imgHeight); Element.setHeight('nextLink', imgHeight); Element.setWidth( 'imageDataContainer', imgWidth + (borderSize * 2));*/ + + /** + * show panorama link + * the only reason why do this at this point is, because this is only done on images + * and we just know the width and height + */ + if( imgWidth/imgHeight >= 2 || imgHeight/imgWidth >= 2 ) + { + Element.show('linHrefPanoLink'); + } this.showImage(); }, @@ -440,9 +450,12 @@ { var meta = this.xmlDoc[IdCurrent].getElementsByTagName('meta').item(i); var metaname = meta.getElementsByTagName('name').item(0).firstChild.data; - var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; + if(meta.getElementsByTagName('value').item(0).hasChildNodes()) { // prevent error in IE + var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; + } else { + var metavalue = ''; + } - var tr = Builder.node('tr'); var tdleft = Builder.node('td', {className: 'linTdMetaLeftColumn'}, metaname ); var tdright = Builder.node('td', metavalue ); @@ -463,14 +476,14 @@ */ switch( this.currentFileType ) { - case '1': + case '1': // image this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') Element.hide('linDivVideoLink'); Element.show('linDivExifLink'); break; - case '2': + case '2': // video Element.show('linDivVideoLink'); Element.hide('linDivExifLink'); @@ -883,7 +896,7 @@ setImageInfoLink: function() { $('linDivInfoLink').style.top = $('linImgMainimage').offsetTop + $('linImgMainimage').offsetHeight + 3; - $('linDivInfoLink').style.left = $('linImgMainimage').offsetLeft + $('linImgMainimage').offsetWidth - 50; // 50: value of view_img.css width = 50px; can't get width with javascript because element is hidden + $('linDivInfoLink').style.left = $('linImgMainimage').offsetLeft + $('linImgMainimage').offsetWidth - 200; // 200: width of linDivInfoLink, value set view_img.css width = 200px; can't get width with javascript because element is hidden Element.show('linDivInfoLink'); }, @@ -928,7 +941,8 @@ }, hideImgInfoNow: function() { - $('linDivMetaOuter').style.display = 'none'; + Element.hide('linDivMetaOuter'); + Element.hide('linHrefPanoLink'); Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; Modified: trunk/linpha2/lib/modules/module.download.php =================================================================== --- trunk/linpha2/lib/modules/module.download.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/modules/module.download.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -25,13 +25,13 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -if( !isset($_GET['linId']) ) +if( $linpha->template->idCurrent == 0 ) { echo i18n("No valid id supplied!"); exit(1); } -$fullfilename = LinSql::getFullImagePath($_GET['linId']); +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); /** * check for valid filename @@ -46,7 +46,7 @@ * get file informations */ $data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($_GET['linId'])."'"); + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); $md5sum = $data['md5sum']; $img_type = $data['img_type']; @@ -54,12 +54,12 @@ /** - * check download permissions and photos permissions + * check photo permissions */ -if( !LinSql::photoIsAllowed( $_GET['linId'], 'read' ) ) +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) { echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); exit(1); } @@ -70,7 +70,7 @@ if( !LinSql::checkPermission('download') AND !LinIdentify::isVideo($img_type) ) { echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); exit(1); } Added: trunk/linpha2/lib/modules/module.panorama.php =================================================================== --- trunk/linpha2/lib/modules/module.panorama.php (rev 0) +++ trunk/linpha2/lib/modules/module.panorama.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -0,0 +1,68 @@ +<?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 md5sum, img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + +$md5sum = $data['md5sum']; +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check photos 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); +} + + + +?> \ No newline at end of file Added: trunk/linpha2/lib/modules/module.video.php =================================================================== --- trunk/linpha2/lib/modules/module.video.php (rev 0) +++ trunk/linpha2/lib/modules/module.video.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -0,0 +1,227 @@ +<?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'); +?> Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/global.html.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -26,21 +26,26 @@ <div id="linDivSyslogText"><?php echo (isset($linTpl->output['sys_log']) ? $linTpl->output['sys_log'] : ''); ?></div> </div> + <!-- title/navigation --> +<?php if(! $linTpl->hideTitle) { ?> <div id="linDivTitle"> <?php echo $linTpl->linpha_title." :: ".$linTpl->output['title']; ?> </div> +<?php } ?> + <!-- menu --> +<?php if(! $linTpl->hideMenu) { ?> <div id="linDivMenu"> <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin,guestbook'); ?> </div> <div style="clear: both;"></div> <!-- end menu --> +<?php } ?> - <?php $linTpl->includeFile('body'); ?> </body> Modified: trunk/linpha2/templates/default/themes/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/view_img.css 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/themes/default/css/view_img.css 2006-12-28 16:26:12 UTC (rev 4667) @@ -39,7 +39,7 @@ text-align: right; font-size: 0.7em; - width: 50px; /* hardcoded in LinImage.js setImageInfoLink() better to not change!*/ + width: 200px; /* hardcoded in LinImage.js setImageInfoLink() better to not change!*/ } #linTableMeta { Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/view_img.html.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -51,6 +51,7 @@ </div> <div id="linDivInfoLink" style="display: none; color: grey;"> + <a id="linHrefPanoLink" href="<?php echo LINPHA_LINK.'linCat=panorama&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank" style="color: black;">Panorama</a> <a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |