[Linpha-cvs] SF.net SVN: linpha: [4657] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-11-16 21:46:58
|
Revision: 4657 http://svn.sourceforge.net/linpha/?rev=4657&view=rev Author: fangehrn Date: 2006-11-16 13:46:57 -0800 (Thu, 16 Nov 2006) Log Message: ----------- 2006-11-16 flo * generate also a md5sum for folders take the full filename * dont generate md5sum for the videos anymore we dont have memory limit problems with the builtin md5_file (tested) * show album comment in album container -> we could do such nice stuff without any javascript if IE only would support max-/min-height !!!! add some album comments to test it Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_select.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/themes/default/css/global.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/ChangeLog 2006-11-16 21:46:57 UTC (rev 4657) @@ -1,3 +1,12 @@ +2006-11-16 flo + * generate also a md5sum for folders + take the full filename + * dont generate md5sum for the videos anymore + we dont have memory limit problems with the builtin md5_file (tested) + * show album comment in album container + -> we could do such nice stuff without any javascript if IE only would support max-/min-height !!!! + add some album comments to test it + 2006-11-15 flo * resolve category names in MetaData::readInformations() * some performance improvements: Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/admin/metadata_select.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -75,8 +75,6 @@ * set exif/iptc fields */ $MetaData = new LinMetaDataAdmin(); - $MetaData->setFields('exif'); - $MetaData->setFields('iptc'); ?> <form name="form_image_fields" method="POST" onsubmit="selectAll()"> <div align="center"> @@ -137,6 +135,10 @@ </select> </td> </tr> + <?php + if($flag_nr != 11 && $flag_nr != 12) + { + ?> <tr> <td> <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> @@ -152,6 +154,7 @@ ?> <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php + $MetaData->setFields('exif'); foreach($MetaData->defined_fields['exif'] AS $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; @@ -175,6 +178,7 @@ ?> <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php + $MetaData->setFields('iptc'); foreach($MetaData->defined_fields['iptc'] AS $key=>$value) { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; @@ -183,6 +187,13 @@ </select> </td> </tr> + <?php + } + else + { + echo '<tr><td height="100"></td><td></td></tr><tr><td height="100"></td><td></td></tr>'; + } + ?> </table> <br /> <input type="hidden" name="cmd" value="select_image_fields" /> Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -211,6 +211,10 @@ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('stats_downloads', 0, 1)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('first_comment', 0, 1)"; + + /** * builtin fields * flag_nr 5 (builtin enabled) @@ -260,11 +264,15 @@ * flag_nr 12 */ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 12)"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; + "(name, field_type, flags) VALUES ('builtin_persons', 0, 12)"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; + "(name, field_type, flags) VALUES ('builtin_first_comment', 0, 12)"; /** Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -957,6 +957,10 @@ { $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; } + elseif($key == 'builtin_first_comment') + { + $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value'].'</div>'; + } else { $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; @@ -1088,28 +1092,36 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); if( $query->EOF ) // insert { - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->template->idCurrent."','".linSql::linAddslashes($_POST['author'])."'," . - "'".linSql::linAddslashes($_POST['comment'])."')"); + $GLOBALS['linpha']->db->Execute( + "INSERT into ".LIN_PREFIX."meta_comments " . + "(meta_time, md5sum, meta_author, meta_comment) " . + "VALUES " . + "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . + "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" + ); } else // update { $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". "meta_time = '".time()."', ". - "meta_author = '".linSql::linAddslashes($_POST['author'])."', " . - "meta_comment = '".linSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); + "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . + "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); } } /** * get data */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments"); + $data = $GLOBALS['linpha']->db->GetRow( + "SELECT id, meta_time, meta_author, meta_comment " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$this->md5sum."'" + ); if(isset($data['meta_author'])) { $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -428,33 +428,27 @@ elseif( is_dir( $dirname.'/'.$filename ) ) { $file_type = 0; + $md5sum = md5($dirname.'/'.$filename); } elseif( is_file( $dirname.'/'.$filename ) ) { list($org_width,$org_height,$file_type) = LinIdentify::linGetImageSize($dirname.'/'.$filename); $filesize = filesize($dirname.'/'.$filename); - /** - * calculate md5sum (not for videos we have - * plenty of memory_limit problems here...) - * - * -> but we need an md5sum for statistics, comments, etc. - * -> calculate one of the full filename - * -> with a re-import all is lost... - * - * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file - * do we have such limits with this function either??? - */ - if( LinIdentify::isVideo($file_type) ) + if( LinIdentify::isVideo($file_type) OR LinIdentify::isSupportedImage($file_type) ) { - $md5sum = md5($dirname.'/'.$filename); + /** + * calculate md5sum + * we dont have memory limit for videos anymore with the builtin md5_file() (tested !) + * + * the calculation of a over 200MB file is done in less than 2 seconds on a newer computer + */ + $md5sum = md5_file($dirname.'/'.$filename); $stats_number = 1; } - elseif( LinIdentify::isSupportedImage($file_type) ) + + if( LinIdentify::isSupportedImage($file_type) ) { - $md5sum = md5_file($dirname.'/'.$filename); - $stats_number = 1; - /** * exif date and exif rotate stuff * globally turn off using 'sys_import_exif' if having problems with phpmeta Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -31,7 +31,7 @@ */ class LinMetaDataRead extends LinMetaData { - public $cachedFieldNames, $cachedSelectedFieldNames, $cachedFieldIds; + public $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; /** * read image information from database @@ -42,8 +42,6 @@ */ function readInformations($array_src_infos, $flag_nr) { - //$GLOBALS['linpha']->db->debug = true; - /** * cache field names if not already done * readInformations() is executed for each thumbnail on a folder @@ -112,6 +110,14 @@ $name = i18n("Nr Of Downloads"); $value = $array_src_infos['stats_downloads']; break; + case 'first_comment': + $name = i18n("First Comment"); + $value = $GLOBALS['linpha']->db->GetOne( + "SELECT meta_comment FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".LinSql::linAddslashes($array_src_infos['md5sum'])."' " . + "ORDER by meta_time ASC" + ); + break; default: /** @@ -939,7 +945,7 @@ /** * enable cache (only possible in object context) - * we wont have to read this for each thumbnail + * we dont want have to read this for each thumbnail */ if(isset($this->cachedFieldNames[$last_part])) { @@ -957,13 +963,13 @@ } break; case 'exif': - $value = LinMetaData::$Tags['exif'][$last_part]; + $value = LinMetaData::$Tags['exif'][$last_part]['name']; if($show_exifiptc_in_brackets) { $value .= ' (exif)'; } break; case 'iptc': - $value = LinMetaData::$Tags['iptc'][$last_part]; + $value = LinMetaData::$Tags['iptc'][$last_part]['name']; if($show_exifiptc_in_brackets) { $value .= ' (iptc)'; } Modified: trunk/linpha2/lib/modules/module.filemanager.php =================================================================== --- trunk/linpha2/lib/modules/module.filemanager.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/modules/module.filemanager.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -39,6 +39,11 @@ * prepared with malicious code (there are known security holes in some video players!) */ +/** + * @todo update md5sum while renaming or moving a folder + * on a folder, the md5sum is based on $md5sum = md5($dirname.'/'.$filename); + */ + if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/templates/default/home.html.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -71,8 +71,10 @@ <div class="linDivFolder"> <?php echo $linTpl->divRoundCorners('top','','albums'); ?> + <div class="linDivThumbnail"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' . '<img class="linImgFolderThumbnail" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> + </div> <div class="linDivFolderText"> <h2 class="linStyle"><?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> @@ -81,8 +83,11 @@ </div> + <div style="clear: both;"></div> + <?php echo $linTpl->divRoundCorners('bottom','','albums'); ?> </div> + <?php } ?> <?php } ?> </div> Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-16 21:46:57 UTC (rev 4657) @@ -133,14 +133,12 @@ width: 700px; } - - .linDivFolderText { - margin: 0; - padding: 5px; + .linDivThumbnail { height: 140px; + float: left; } - + .linImgFolderThumbnail { margin: 0; margin-left: 20px; @@ -148,15 +146,23 @@ margin-top: 5px; padding: 0; - float: left; - width: 130px; height: 130px; border: 0; } + .linDivFolderText { + margin: 0; + padding: 5px; + } + .linDivFolderComment { + overflow: auto; + max-height: 300px; + } + + /** * menu */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |