[Linpha-cvs] SF.net SVN: linpha: [4610] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-10-31 21:32:04
|
Revision: 4610 http://svn.sourceforge.net/linpha/?rev=4610&view=rev Author: fangehrn Date: 2006-10-31 13:31:46 -0800 (Tue, 31 Oct 2006) Log Message: ----------- 2006-10-31 flo * saving img width and height during import in database Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/lib.install.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.oci8po.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/lib/classes/linpha.import.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/ChangeLog 2006-10-31 21:31:46 UTC (rev 4610) @@ -1,3 +1,6 @@ +2006-10-31 flo + * saving img width and height during import in database + 2006-10-30 flo * implemented ajax login/logout * implemented "view at" Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/lib.install.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -201,8 +201,16 @@ { if( ! installIsAbsolutePath( $path ) ) { - //$path = str_ireplace("../", " ", $path ); - $path = realpath($path); + if(file_exists($path)) + { + $path = realpath($path); + } + else + { + // remove first ../ because we are here in the install directory + $path = substr($path,3,strlen($path)-3); + $path = realpath(LINPHA_DIR).'/'.$path; + } } /** @@ -215,6 +223,18 @@ $path = substr($path,0,$len-1); } + /** + * unify slashes + */ + if(strpos( PHP_OS, 'WIN' ) !== FALSE) + { + $path = str_replace('/','\\',$path); + } + else + { + $path = str_replace('\\','/',$path); + } + return $path; } @@ -428,7 +448,7 @@ foreach($array AS $value) { /** - * remove '/' if not already done + * remove ending slash if not already done */ $len = strlen( $_POST[$value.'_dir'] ); $lastsign = substr( $_POST[$value.'_dir'], $len-1); Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/sql/sql.data.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -110,7 +110,18 @@ 'sys_style_thumb_nojsnrcols', 'sys_style_image_width', 'sys_style_image_height', - 'sys_style_image_nrprevnextthumbs' + 'sys_style_image_nrprevnextthumbs' => '3', + 'sys_style_image_useeffects' => '1', + + 'sys_style_layout_color_bodybg' => 'DDDDDD', // the blue design + 'sys_style_layout_color_elembg' => '87CEFA', + 'sys_style_layout_color_font' => '000000', + 'sys_style_layout_color_albumsbg' => 'D5FCF4', + 'sys_style_layout_color_links' => '005388', + 'sys_style_layout_color_linkshover' => '666666', + + 'sys_style_layout_theme' => 'default', + 'sys_style_layout_template' => 'default', ); /** Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -64,6 +64,8 @@ "img_type INT NOT NULL default '0', " . "name VARCHAR(255) NOT NULL, " . "md5sum VARCHAR(32) NOT NULL default '', " . + "width INT NOT NULL default '0', " . + "height INT NOT NULL default '0', " . "time_add INT NOT NULL default '0', " . "time_mod INT NOT NULL default '0', " . "time_exif INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/install/sql/sql.oci8po.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/sql/sql.oci8po.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -59,6 +59,8 @@ "img_type NUMBER(10) DEFAULT '0', " . "name VARCHAR2(255) NOT NULL, " . "md5sum VARCHAR2(32), " . + "width NUMBER(10) default '0', " . + "height NUMBER(10) default '0', " . "time_add NUMBER(12) DEFAULT '0', " . "time_mod NUMBER(12) DEFAULT '0', " . "time_exif NUMBER(12) DEFAULT '0', " . Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -59,6 +59,8 @@ "img_type INT NOT NULL default '0', " . "name VARCHAR(255) NOT NULL, " . "md5sum VARCHAR(32) NOT NULL default '', " . + "width INT NOT NULL default '0', " . + "height INT NOT NULL default '0', " . "time_add INT NOT NULL default '0', " . "time_mod INT NOT NULL default '0', " . "time_exif INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -59,6 +59,8 @@ "img_type INTEGER NOT NULL default '0', " . "name VARCHAR(255) NOT NULL, " . "md5sum VARCHAR(32) NOT NULL default '', " . + "width INTEGER NOT NULL default '0', " . + "height INTEGER NOT NULL default '0', " . "time_add INTEGER NOT NULL default '0', " . "time_mod INTEGER NOT NULL default '0', " . "time_exif INTEGER NOT NULL default '0', " . Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-10-29 23:55:17 UTC (rev 4609) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-10-31 21:31:46 UTC (rev 4610) @@ -167,12 +167,13 @@ linSysLog(i18n("New").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); - list($md5sum,$file_type,$stats_number,$time_exif,$rotate) = LinImport::getFileInformation($dirname,$filename); + list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate) = + LinImport::getFileInformation($dirname,$filename); $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . - "parent_id, name, img_type, md5sum, time_add, time_mod, time_exif, rotate, stats_numbers ) " . + "parent_id, name, img_type, md5sum, width, height, time_add, time_mod, time_exif, rotate, stats_numbers ) " . "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . - "'".$file_type."' , '".$md5sum."', '".time()."', '".filemtime($dirname.'/'.$filename)."', '".$time_exif."', '".$rotate."', '".$stats_number."' )"); + "'".$file_type."' , '".$org_width."' , '".$org_height."' , '".$md5sum."', '".time()."', '".filemtime($dirname.'/'.$filename)."', '".$time_exif."', '".$rotate."', '".$stats_number."' )"); /** * delete thumbnail if one exists with the same id @@ -271,24 +272,36 @@ */ function updateEntry( $id , $dirname , $filename ) { - list($md5sum,$file_type,$stats_number,$time_exif,$rotate) = LinImport::getFileInformation($dirname,$filename); + list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate) + = LinImport::getFileInformation($dirname,$filename); $data = $GLOBALS['linpha']->db->GetRow("SELECT img_type, md5sum " . "FROM ".PREFIX."photos WHERE id = '".$id."'"); /** * update file_type + * + * on change of file_type, change: + * - img_type + * - width and height + * - time_exif + * - stats_numbers */ if($file_type != $data[0]) { linSysLog(i18n("Detected a change of file_type in:")." ".htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos " . - "SET img_type = '".$file_type."', stats_numbers = '".$stats_number."' " . + "SET img_type = '".$file_type."', width = '".$org_width."', height = '".$org_height."', time_exif = '".$time_exif."', stats_numbers = '".$stats_number."' " . "WHERE id = '".$id."'"); } /** * update md5sum + * + * on change of md5sum, change: + * - width and height + * - time_exif, time_mod + * - rotate ?) */ /** * @todo hey, thats a nice feature! we are now able to detect @@ -299,7 +312,7 @@ linSysLog(sprintf(i18n("File %s changed, updating data..."),htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES))); $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos " . - "SET md5sum = '".$md5sum."' WHERE id = '".$id."'"); + "SET md5sum = '".$md5sum."', width = '".$org_width."', height = '".$org_height."', time_mod = '".filemtime($dirname.'/'.$filename)."', time_exif = '".$time_exif."', rotate = '".$rotate."' WHERE id = '".$id."'"); LinImport::updateMd5sum( $id, $data[1], $md5sum ); LinImage::createThumbnail( $id , $file_type , $force=true ); @@ -352,6 +365,8 @@ $stats_number = 0; $time_exif = "0"; $rotate = "0"; + $org_width = "0"; + $org_height = "0"; $ext = LinFilesys::getFileExtFromPath($filename); if($filename{0} == '.') @@ -443,7 +458,7 @@ linSysLog('Error: what am i? '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); } - return array($md5sum,$file_type,$stats_number,$time_exif,$rotate); + return array($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |