[Linpha-cvs] SF.net SVN: linpha: [4625] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-11-08 22:21:24
|
Revision: 4625 http://svn.sourceforge.net/linpha/?rev=4625&view=rev Author: fangehrn Date: 2006-11-08 14:20:32 -0800 (Wed, 08 Nov 2006) Log Message: ----------- 2006-11-08 flo * finished new folder thumbnail - use a gif instead of png - much smaller (about 20kb instead of >100kb) - the transparency works in internet explorer - but we have no shadow i tested also the filesize and time to create the thumbnail: * with -colors 64: 18.32KB 1.1s * with -colors 128: 22.29KB 1.07s * with -colors 256: 27.19KB 3.9s !! * with -colors 512: 27.09KB 4.5s !! * * it seems that the -quality switch doesnt matter with gif images i've choosen 128 colors, i think the quality is enough..?? Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/default/themes/default/css/global.css Added Paths: ----------- trunk/linpha2/lib/graphics/thumb_folder.gif Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/ChangeLog 2006-11-08 22:20:32 UTC (rev 4625) @@ -1,3 +1,19 @@ +2006-11-08 flo + * finished new folder thumbnail + - use a gif instead of png + - much smaller (about 20kb instead of >100kb) + - the transparency works in internet explorer + - but we have no shadow + i tested also the filesize and time to create the thumbnail: + * with -colors 64: 18.32KB 1.1s + * with -colors 128: 22.29KB 1.07s + * with -colors 256: 27.19KB 3.9s !! + * with -colors 512: 27.09KB 4.5s !! + * + * it seems that the -quality switch doesnt matter with gif images + i've choosen 128 colors, i think the quality is enough..?? + + 2006-11-06 flo * fixed some bugs * testing new folder thumbnail Modified: trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -25,9 +25,53 @@ if(!defined('LINPHA_DIR')) { exit(1); } +/* +roundrectangle 1,1 122,92 15,15 +# create the old style folder thumb +convert -size 182x182 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 \ + -quality 70 output_file + +# create a rounded corner folder thumb with shadow +only works with png as output format +but this cause a too high file size (>100KB) +and in IE the png transparency is shown correctly +see also http://www.cit.gu.edu.au/~anthony/graphics/imagick6/thumbnails/ + +convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \ + -background none -fill none -stroke black -strokewidth 3 \ + -draw "roundrectangle 1,1 122,92 15,15" rounded_corner_overlay.png +convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \ + -background none -fill white -stroke black -strokewidth 1 \ + -draw "roundrectangle 1,1 122,92 15,15" rounded_corner_mask.png + + + +# create the rounded corner folder thumb + - open gimp + - create new empty image, 200x200 transparent background + - use Auswahl - Alles, Auswahl - Abgerundetes Rechteck 20% + - fill with black color + - use Auswahl - Verkleinern - 2 pixel + - fill with color #fefaca + - save as gif + + +to composite the four images to the folder image, we could do this with only one command +but there seems to be a bug in imagemagick 6.2.4 (used in ubuntu 6.06 lts, see also http://www.imagemagick.org/pipermail/magick-users/2006-June/017707.html) +so we have to deal with it... + convert -size 100x100 xc:skyblue \ + balloon.gif -geometry 40x40+5+10 -composite \ + medical.gif -geometry +35+30 -composite \ + present.gif -geometry 24x24+62+50 -composite \ + shading.gif -geometry 16x16+10+55 -composite \ + compose_resize.gif +*/ + + + /** - * create new tmp folder + * create new unique tmp folder */ for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; @@ -38,31 +82,43 @@ */ for($i=1; list($key,$value) = each($array_ids) ; $i++) { - LinFilesys::linExec("convert ". LinImage::getCachePath('thumb',$value) . " -quality 70 -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); + LinFilesys::linExec($this->imagemagick_path."convert ". LinImage::getCachePath('thumb',$value) . " -quality 70 -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); } -// LinFilesys::linExec("convert -size 182x182 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 -quality 70 ".$this->output_file); - + $str = $this->imagemagick_path."convert ".LINPHA_DIR."/lib/graphics/thumb_folder.gif "; + for($i=1; $i<=count($array_ids); $i++ ) { switch($i) { case 1: - //LinFilesys::linExec("composite -compose atop -geometry +15+15 -quality 70 ".$tmp_folder."/1.jpg ".$this->output_file." ".$this->output_file); - LinFilesys::linExec("composite -compose atop -geometry +15+15 -quality 70 ".$tmp_folder."/1.jpg ".LINPHA_DIR."/lib/graphics/thumb_folder.png ".$this->output_file); + $str .= $tmp_folder."/1.jpg -geometry +15+15 -composite "; break; case 2: - LinFilesys::linExec("composite -compose atop -geometry +105+15 -quality 70 ".$tmp_folder."/2.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/2.jpg -geometry +105+15 -composite "; break; case 3: - LinFilesys::linExec("composite -compose atop -geometry +15+105 -quality 70 ".$tmp_folder."/3.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/3.jpg -geometry +15+105 -composite "; break; case 4: - LinFilesys::linExec("composite -compose atop -geometry +105+105 -quality 70 ".$tmp_folder."/4.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/4.jpg -geometry +105+105 -composite "; break; } } + + /** + * filesizes and time: + * with -colors 64: 18.32KB 1.1s + * with -colors 128: 22.29KB 1.07s + * with -colors 256: 27.19KB 3.9s !! + * with -colors 512: 27.09KB 4.5s !! + * + * it seems that the -quality switch doesnt matter with gif images + */ + $str .= "-colors 128 ".$this->output_file; + LinFilesys::linExec( $str ); + /** * delete tmp folder */ Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -145,12 +145,9 @@ if($this->mode == 'thumb') { $this->cached_id = $this->photo_id; - if($this->img_type == 0) - { - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id).'.png'; - } - else - { + if($this->img_type == 0) { // folder are gif files + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id,'.gif'); + } else { $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); } @@ -484,7 +481,7 @@ * @param int $id image id * @return string full path to cached image */ -function getCachePath($what,$id) +function getCachePath($what,$id,$ext='.jpg') { $path = LinSql::getPath('cache'); @@ -497,7 +494,7 @@ $subdir = substr($id,0,2); } - return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; + return $path .'/'. $what .'/' .$subdir .'/'.$id .$ext; } /** @@ -598,9 +595,9 @@ */ function printFileToScreen() { - if( $this->img_type == 0 ) + if( $this->img_type == 0 ) // folder are gif images, all other are jpg { - header("Content-type: image/png"); + header("Content-type: image/gif"); } else { Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -179,56 +179,35 @@ */ function printMenus($modules,$comingfrom_ajax=false) { - if(strpos($modules,'home') !== false) + $array = explode(',',$modules); + foreach($array AS $value) { - $fragment = 'menu_home'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - if(strpos($modules,'search') !== false) - { - $fragment = 'menu_search'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'login') !== false) - { - $fragment = 'menu_login'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'more') !== false) - { - if( isset( $this->output['menu_More'] ) ) { - $this->printMenu("More"); + switch($value) + { + case 'more': + if( isset( $this->output['menu_More'] ) ) { + $this->printMenu("More"); + } + break; + case 'settings': + if($GLOBALS['linpha']->sql->isLoggedIn()) { + echo '<!-- my settings -->'."\n"; + $this->printMenu("My Settings",LINPHA_LINK."&linCat=settings"); + } + break; + case 'admin': + if($GLOBALS['linpha']->sql->isLoggedIn()) { + echo '<!-- admin links -->'."\n"; + $this->printMenu("Admin",LINPHA_CLIENT."/admin/"); + } + break; + default: // all other, like home, search, login, guestbook, icons, more + $fragment = 'menu_'.$value; + include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); + break; } } - if(strpos($modules,'icons') !== false) - { - $fragment = 'menu_icons'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'settings') !== false) - { - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- my settings -->'."\n"; - $this->printMenu("My Settings",LINPHA_LINK."&linCat=settings"); - } - } - - if(strpos($modules,'admin') !== false) - { - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- admin links -->'."\n"; - $this->printMenu("Admin",LINPHA_CLIENT."/admin/"); - } - } - if($comingfrom_ajax && isset($this->output['sys_log']) && !empty($this->output['sys_log'])) { echo '<script language="JavaScript" type="text/javascript">myLinGlobal.linSyslog("'.$this->output['sys_log'].'");</script>'; Added: trunk/linpha2/lib/graphics/thumb_folder.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/graphics/thumb_folder.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/js/LinGlobal.js 2006-11-08 22:20:32 UTC (rev 4625) @@ -75,8 +75,8 @@ { if( t.responseText == 'use_js saved' ) { + myLinGlobal.linSyslog('Ajax enabled'); location.href = document.location; - this.linSyslog('Ajax enabled'); } }, Modified: trunk/linpha2/lib/lang/lang.German.php =================================================================== --- trunk/linpha2/lib/lang/lang.German.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/lang/lang.German.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -61,6 +61,7 @@ "Random images" => "Zufallsbilder", "Browse by Date" => "Nach Datum durchsuchen", "Albums" => "Alben", -"Photos" => "Fotos" +"Photos" => "Fotos", +"You must have cookies enabled to log in." => "Um sich anmelden zu k\xF6nnen, m\xFCssen Cookies aktiviert sein.", ); ?> Modified: trunk/linpha2/templates/default/fragments.php =================================================================== --- trunk/linpha2/templates/default/fragments.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/fragments.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -2,14 +2,16 @@ switch($fragment) { -case 'menu_home': + +case 'menu_home': /* menu item 'home' */ ?> <ul style="margin-left: 50px;"> <li><a href="<?php echo LINPHA_LINK; ?>&linCat=alb"><?php echo i18n("Home"); ?></a></li> </ul> <?php break; -case 'menu_search': + +case 'menu_search': /* menu item 'search' */ ?> <ul> <li><span><?php echo i18n("Search"); ?> </span> @@ -22,7 +24,7 @@ <input type="hidden" name="button[meta][all]" value="1" /> <input type="hidden" name="cmd" value="search" /> <input type="hidden" name="linCat" value="search" /> - <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> </form> </div> </li> @@ -31,7 +33,8 @@ </ul> <?php break; -case 'menu_login': + +case 'menu_login': /* menu item 'login' */ ?> <ul> <li> @@ -50,11 +53,13 @@ <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> <?php } else { ?> <!-- login infos --> + <br /> <label for="formUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="formUsername" /><br /> <label for="formPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="formPassword" /><br /> <?php if($GLOBALS['linpha']->sql->config->value['sys_user_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="formCheckboxRemember" /><label for="formCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> <input type="hidden" name="cmd" value="login" /> - <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> + <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> <?php } ?> </form> @@ -65,7 +70,8 @@ </ul> <?php break; -case 'menu_icons': + +case 'menu_icons': /* menu item 'icons' */ ?> <!-- icons --> <div> @@ -75,6 +81,45 @@ </div> <?php break; + +case 'menu_guestbook': /* menu item 'guestbook' */ +if( false ) +{ +?> + <!-- guestbook --> + <ul> + <li> + <a href="<?php echo LINPHA_LINK.'&linCat=guestbook'; ?>"><?php echo i18n("Guestbook"); ?></a> + </li> + </ul> +<?php +} +break; + +case 'menu_empty1': /* menu item 'emtpy1' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + +case 'menu_empty2': /* menu item 'empty2' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + + +/** + * the slideshow controls + */ case 'slideshow': ?> <div id="linDivSlideshowControls"> Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/global.html.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -33,7 +33,7 @@ <!-- menu --> <div id="linDivMenu"> - <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin'); ?> + <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin,guestbook'); ?> </div> <div style="clear: both;"></div> Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -65,6 +65,6 @@ #linDivMenu ul a:hover, #linDivMenu ul span:hover { background: #bbbbbb; } - #linDivMenu ul ul { + #linDivMenu ul ul, .linInputMenu { background-color: #eeeeee; } Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-08 22:20:32 UTC (rev 4625) @@ -183,7 +183,7 @@ padding: 0; float: left; } - + /** * first level elements */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |