[Linpha-cvs] SF.net SVN: linpha: [4467] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-01 11:10:21
|
Revision: 4467 Author: fangehrn Date: 2006-04-01 03:09:56 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4467&view=rev Log Message: ----------- * update several folder paths -> it should now work if you specify an other album dir than ./albums -> all paths stored and handled in linpha doesn't contain an ending '/' !! if the do, getFullPath() removes it !! * installer tested -> it works :-) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/get_thumb.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/templates/default/css/view_thumb.css trunk/linpha2/templates/default/home.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/ChangeLog 2006-04-01 11:09:56 UTC (rev 4467) @@ -1,3 +1,12 @@ +2006-04-01 flo + * update several folder paths + -> it should now work if you specify an other album dir than ./albums + -> all paths stored and handled in linpha doesn't contain an ending '/' !! + if the do, getFullPath() removes it !! + + * installer tested + -> it works :-) + 2006-03-31 bzrudi <linpha2_AT_tuxpower_DOT_de> * Installer: + at least mysql installation should work now Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/get_thumb.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -59,9 +59,12 @@ $force = false; } - $output_file = linImage::createThumbnail($data['id'],$data['img_type'],$force); - Header("Content-type: image/jpeg"); - readfile( $output_file ); + $output_file = LinImage::createThumbnail($data['id'],$data['img_type'],$force); + if(file_exists($output_file)) + { + Header("Content-type: image/jpeg"); + readfile( $output_file ); + } } catch(Exception $error) { Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/lib.install.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -46,7 +46,7 @@ */ if($tr_learn == true) { - $tmpfile = LINPHA_DIR."/var/tmp/lang.install.temp.txt"; + $tmpfile = LINPHA_DIR."/var/lang.install.temp.txt"; if(false == file_exists("$tmpfile")) { @@ -170,6 +170,51 @@ } /** +* create directory recursively - same as "mkdir -p" +*/ +function mkdir_p($target,$mode='0700') +{ + if(is_dir($target) || empty($target)) { // best case check first + return true; + } + if(file_exists($target) && !is_dir($target)) { // target exists bug isn't a directory.. + return false; + } + if( mkdir_p( substr( $target,0,strrpos( $target,'/') ) ) ) + { + return mkdir($target,intval($mode,8)); // crawl back up & create dir tree + } + else + { + return false; + } +} + +/** + * realpath() doesnt work if path is absolute + * linpha_realpath takes care of this + */ +function linpha_realpath( $path) +{ + if( ! is_absolute_path( $path ) ) + { + $path = realpath( $path ); + } + + /** + * remove ending '/' if exists + */ + $len = strlen( $path ); + $lastsign = substr( $path, $len-1); + if($lastsign == '/' OR $lastsign == '\\') + { + $path = substr($path,0,$len-1); + } + + return $path; +} + +/** * if $path is absolute, this is returned, if $path is relative, the relative path starting * from the linpha rootdirectory is returned * Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step2_requirements.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -376,7 +376,7 @@ print_foot(); echo "<br />"; -echo tr("For More Detailed Info - Please Click On The Status Text")."<br />; +echo tr("For More Detailed Info - Please Click On The Status Text")."<br />"; ?> <a href="#" onclick="show_hide_tables('',<?php echo $table_lines; ?>)"> Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step4_selectdirectories.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -23,12 +23,13 @@ if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } +include_once(LINPHA_DIR.'/install/header.php'); + $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); $sql_dir = (isset($_SESSION['sql_dir']) ? $_SESSION['sql_dir_parent'] : 'var/'); $cache_dir = (isset($_SESSION['cache_dir']) ? $_SESSION['cache_dir_parent'] : 'var/'); $tmp_dir = (isset($_SESSION['tmp_dir']) ? $_SESSION['tmp_dir_parent'] : 'var/'); -include_once(LINPHA_DIR.'/install/header.php'); /** * save settings from previous page @@ -68,10 +69,10 @@ <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$album_dir); ?>) +(-> <?php echo linpha_realpath( get_full_path($album_dir) ); ?>) <br /><br /> -<h2><?php echo tr("Warning: All Subdirectories Will Be Deleted"); ?></h2> +<h2><?php echo tr("Warning: All Existing Subdirectories Will Be Deleted"); ?></h2> <br /> <div class="boxalign"> @@ -79,7 +80,7 @@ <input class="boxalignelement" type="text" id="check02" onKeyup="checkForm()" name="sql_dir" size="30" value="<?php echo $sql_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$sql_dir); ?>/sql) +(-> <?php echo linpha_realpath( get_full_path($sql_dir) ); ?>/sql) <br /><br /> <div class="boxalign"> @@ -87,7 +88,7 @@ <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" name="cache_dir" size="30" value="<?php echo $cache_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$cache_dir); ?>/cache) +(-> <?php echo linpha_realpath( get_full_path($cache_dir) ); ?>/cache) <br /><br /> <div class="boxalign"> @@ -95,7 +96,7 @@ <input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" name="tmp_dir" size="30" value="<?php echo $tmp_dir; ?>"> </div> -(-> <?php echo realpath(LINPHA_DIR.'/'.$tmp_dir); ?>/tmp) +(-> <?php echo linpha_realpath( get_full_path($tmp_dir) ); ?>/tmp) <br /><br /> <?php Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -90,12 +90,12 @@ if( is_writable( $dirs['album'] ) ) { echo success_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.realpath( $dirs['album'] ).')'; + echo '<br /> ('.$_SESSION['album_dir'].' => '.linpha_realpath( $dirs['album'] ).')'; } else { echo warning_msg(); - echo '<br /> ('.$_SESSION['album_dir'].' => '.realpath( $dirs['album'] ).')'; + echo '<br /> ('.$_SESSION['album_dir'].' => '.linpha_realpath( $dirs['album'] ).')'; echo "<br />".tr("Album Directory Not Writable. Some Features May Not Work")."<br />"; } } @@ -110,6 +110,20 @@ foreach($array AS $value) { echo "<br /><br />Checking ".$value." Directory... "; + if(! is_dir( $dirs[$value.'_parent'] ) ) + { + echo warning_msg(); + echo "<br />".tr("Directory ".$dirs[$value.'_parent']." Doesnt Exists - Trying To Create")."... "; + if( mkdir_p( $dirs[$value.'_parent'] ) ) + { + echo success_msg(); + } + else + { + echo failed_msg(); + } + } + if( is_dir( $dirs[$value.'_parent'] ) ) { if( is_writable( $dirs[$value.'_parent'] ) ) @@ -133,13 +147,13 @@ { echo success_msg(); } - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; + echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.linpha_realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; } else { echo failed_msg(); echo "<br />".tr("No Write Permissions. Please Change Permissions Or Choose Another Directory")."!"; - echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; + echo '<br /> ('.$_SESSION[$value.'_dir'].' => '.linpha_realpath( $dirs[$value.'_parent'] ).'/'.$value.')'; $error_nr = 1; } } Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step8_testing.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -118,7 +118,6 @@ /** * try to create a new db user */ -$str_cant_create_user = "Cannot create a new user for the linpha database. Always use the one you specified for all linpha operations..."; $n_runs = 1; if($_SESSION['sql_dbtype']=="mysql") { @@ -138,6 +137,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -145,6 +145,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -156,6 +157,7 @@ { echo warning_msg(); echo "<br />".tr("Failed To Create New User"); + echo "<br />".tr("Will use the one you specified for all linpha operations..."); } else { @@ -175,6 +177,7 @@ */ /** * prevent test running sqlite db + * @todo why?? -flo */ if($_SESSION['sql_dbtype'] != 'sqlite') { Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/install/step9_createtables.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -115,32 +115,20 @@ * create cache directories */ echo "<br /><br />".tr("Creating Directories")."... "; - @mkdir( get_full_path( $_SESSION['cache_dir'] ), 0700 ); - - $imgcachedir = get_full_path( $_SESSION['cache_dir'] ).'img'; - $thumbcachedir = get_full_path( $_SESSION['cache_dir'] ).'thumb'; - @mkdir($imgcachedir, 0700); - for($i=0 ; $i<=9 ; $i++) - { - @mkdir($imgcachedir.'/'.$i, 0700); - } + mkdir( get_full_path( $_SESSION['cache_dir'] ), 0700 ); + mkdir(get_full_path( $_SESSION['cache_dir'] ).'img', 0700); + mkdir(get_full_path( $_SESSION['cache_dir'] ).'thumb', 0700); - @mkdir($thumbcachedir, 0700); - for($i=0 ; $i<=9 ; $i++) - { - @mkdir($thumbcachedir.'/'.$i, 0700); - } - /** * create tmp dirs */ - @mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); - //@mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); + mkdir( get_full_path( $_SESSION['tmp_dir'] ), 0700 ); + //mkdir( get_full_path( $_SESSION['tmp_dir'] ).'adocache',0700 ); /** * create sql dir */ - @mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); + mkdir( get_full_path( $_SESSION['sql_dir'] ), 0700 ); echo success_msg(); Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -37,13 +37,22 @@ */ function getFullPath($path) { - if(linFilesys::isAbsolutePath($path)) { - $full_path = $path; - } else { - $full_path = LINPHA_DIR.'/'.$path; + if( ! LinFilesys::isAbsolutePath($path)) + { + $path = LINPHA_DIR.'/'.$path; } - return $full_path; + /** + * remove ending '/' if exists + */ + $len = strlen( $path ); + $lastsign = substr( $path, $len-1); + if($lastsign == '/' OR $lastsign == '\\') + { + $path = substr($path,0,$len-1); + } + + return $path; } Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -52,7 +52,7 @@ */ if($tr_learn == true) { - $tmpfile = LINPHA_DIR."/var/tmp/lang.temp.txt"; + $tmpfile = LINPHA_DIR."/var/lang.temp.txt"; if(false == file_exists("$tmpfile")) { Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -103,7 +103,9 @@ * This function extends PHP's getimagesize() function. This include's * support for TIFF like files with PHP < 4.2.0 and others * - * @todo is this still necesarry using php > 5.x ??? + * @todo bzrudi: is this still necesarry using php > 5.x ??? + * @todo flo: yes i think so, imagemagick supports much more images than the gdlib + * but i don't now about the detectTiffType() stuff * * @author bzrudi,flo * @param string $path path to image @@ -145,9 +147,15 @@ if($return_value == 0) // identify succeed { - $g = explode( " ", $array_output[0] ); + if(isset($array_output[0])) + { + print_r($array_output); + exit(); + + $g = explode( " ", $array_output[0] ); - $g[2] = linIdentify::convertImagetype($g[2],$path); + $g[2] = linIdentify::convertImagetype($g[2],$path); + } } } } Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -52,23 +52,12 @@ function createThumbnail($id,$img_type,$force) { /** - * @todo remove workaround when installer implemented - */ - if( ! file_exists ( $GLOBALS['linpha']->sql->getPath('cache') . '/thumb' ) ) - { - mkdir( $GLOBALS['linpha']->sql->getPath('cache') . '/thumb' ); - } - - - $output = linSql::getCachePath('thumb',$id); - - - /** * check if thumbnail already exists OR if forced */ + $output = linSql::getCachePath('thumb',$id); if( ! file_exists( $output ) OR $force ) { - linSysLog('Create thumbnail '.$id.'<br />'); + linSysLog("Create thumbnail".$id."<br />"); /** * create subfolder if needed @@ -111,9 +100,8 @@ /** * create new tmp folder */ - $tmp_dir = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; - for($i=0; file_exists(linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = linFilesys::getFullPath($tmp_dir).'thumb_folder_'.session_id().'_'.$i; + for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } + $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; mkdir($tmp_folder,0700); /** @@ -167,84 +155,93 @@ */ $array_path = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); $album_dir = $GLOBALS['linpha']->sql->getPath('album'); - $src_file = $album_dir . implode('/',$array_path); + $src_file = $album_dir .'/'. implode('/',$array_path); - list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize( $src_file ); - - /** - * create video thumbnail - * @todo - */ - if( linIdentify::isVideo( $org_type ) ) + if(! file_exists($src_file)) { + echo $src_file.' '; + echo i18n("File doesnt exist anymore").'. '; + echo i18n("You should consider start a re-import of your files/folders").'<br />'; + } + else + { + list($org_width,$org_height,$org_type) = LinIdentify::linGetImageSize( $src_file ); + /** - * @todo $tmp_file = create_video_thumbnail($src_file); + * create video thumbnail + * @todo + */ + if( linIdentify::isVideo( $org_type ) ) + { + /** + * @todo $tmp_file = create_video_thumbnail($src_file); + */ + $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; + + } + /** + * create image thumbnail */ - $output = LINPHA_DIR.'/lib/graphics/avi_mov.gif'; - + elseif( linIdentify::isSupportedImage( $org_type ) ) + { + /** + * read thumbsize + */ + $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; + $q = 75; + + + /*$max_width = $thumbsize; + $max_height = $thumbsize; + $w = $thumbsize; + $h = $thumbsize;*/ + + /** + * set parameters + */ + /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); + $w = $array['w']; + $h = $array['h'];*/ + + + /** + * crop image + */ + $ratio = $org_width/$org_height; + if($ratio==1) + { + $x = 0; + $y = 0; + $w = $thumbsize; + $h = $thumbsize; + } + elseif($ratio>1) + { + $x = ( ($thumbsize*$ratio) - $thumbsize )/2; + $y = 0; + $w = ''; + $h = $thumbsize; + } + elseif($ratio<1) + { + $y = ( $thumbsize - ($thumbsize*$ratio) )/2; + $x = 0; + $w = $thumbsize; + $h = ''; + } + + $convert_str = 'convert'. + ' -quality '.$q. + ' -size '.$w.'x'.$h. // new size + ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop + ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! + ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles + ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images + ' '.lin_escape_string( $output ); + + exec( $convert_str ); + } } - /** - * create image thumbnail - */ - elseif( linIdentify::isSupportedImage( $org_type ) ) - { - /** - * read thumbsize - */ - $thumbsize = $GLOBALS['linpha']->sql->config->value['sys_style_tn_size']; - $q = 75; - - - /*$max_width = $thumbsize; - $max_height = $thumbsize; - $w = $thumbsize; - $h = $thumbsize;*/ - - /** - * set parameters - */ - /*$array = linImage::scaleToFit($org_height,$org_width,$max_height,$max_width,0); - $w = $array['w']; - $h = $array['h'];*/ - - - /** - * crop image - */ - $ratio = $org_width/$org_height; - if($ratio==1) - { - $x = 0; - $y = 0; - $w = $thumbsize; - $h = $thumbsize; - } - elseif($ratio>1) - { - $x = ( ($thumbsize*$ratio) - $thumbsize )/2; - $y = 0; - $w = ''; - $h = $thumbsize; - } - elseif($ratio<1) - { - $y = ( $thumbsize - ($thumbsize*$ratio) )/2; - $x = 0; - $w = $thumbsize; - $h = ''; - } - - $convert_str = 'convert'. - ' -quality '.$q. - ' -size '.$w.'x'.$h. // new size - ' -crop '.$thumbsize.'x'.$thumbsize.'+'.$x.'+'.$y. // crop - ' '.lin_escape_string( $src_file ).'[0]'. // [0] -> take only first frame!!! - ' -thumbnail "'.$w.'x'.$h.'"'. // new size and delete profiles, no need anymore for ' +profile "*"'. // delete all profiles - ' -colorspace RGB'. // change colorspace always to RGB because all browsers only can display RGB images - ' '.lin_escape_string( $output ); - - exec( $convert_str ); - } } } Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -47,7 +47,6 @@ public $photos_filtered; public $use_javascript; public $id_current, $id_parent, $img_type, $filename, $md5sum; -private $album_dir; private $nr_pages, $current_page; // only used if javascript disabled /** @@ -55,11 +54,6 @@ */ function __construct() { - /** - * get some variables - */ - $this->album_dir = $GLOBALS['linpha']->sql->getPath('album'); - } @@ -613,6 +607,7 @@ /** * setup random imgages view + * @todo what if the file doesnt exists anymore? */ function setRandomImages() { @@ -630,7 +625,7 @@ } $GLOBALS['linpha']->template->output['random_images'] = Array(); - $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 ORDER BY ".$str_random, $GLOBALS['nr_random_images']); + $query = $GLOBALS['linpha']->db->SelectLimit("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999 ORDER BY ".$str_random, $GLOBALS['nr_random_images']); while($data = $query->FetchRow()) { $path = implode('/',linSql::getFullFilenameFromId($data['id'])); @@ -704,7 +699,8 @@ $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $this->id_current ); - $this->full_filename = $this->album_dir.implode('/',$array_files); + $filename = LinSql::getPath('album').'/'.implode('/',$array_files); + $this->full_filename = LinFilesys::getFullPath( $filename ); $this->viewImg_viewReadImageInformation(); @@ -767,7 +763,7 @@ { include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + $MetaData->saveExifData( $this->full_filename,$this->md5sum); } } @@ -784,7 +780,7 @@ { include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData(LINPHA_DIR.'/'.$this->full_filename,$this->md5sum); + $MetaData->saveIptcData( $this->full_filename,$this->md5sum); } } @@ -825,10 +821,10 @@ $value = $this->filename; break; case 'imagesize': - $value = filesize(LINPHA_DIR.'/'.$this->full_filename); + $value = filesize( $this->full_filename ); break; case 'dimension': - $array = linIdentify::linGetImageSize(LINPHA_DIR.'/'.$this->full_filename); + $array = LinIdentify::linGetImageSize( $this->full_filename ); $value = $array[0].'x'.$array[1]; break; } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -41,13 +41,12 @@ { if($parent_id == 0) { - $dirname = $GLOBALS['linpha']->sql->getPath('album'); + $dirname = LinSql::getPath('album'); } else { - $array = $GLOBALS['linpha']->sql->getFullFilenameFromId( $parent_id ); - $path_str = $GLOBALS['linpha']->sql->config->value['sys_path_album_dir'] . implode('/',$array) . '/'; - $dirname = linFilesys::getFullPath( $path_str ); + $array = LinSql::getFullFilenameFromId( $parent_id ); + $dirname = LinSql::getPath('album') .'/'. implode('/',$array); } if( ! file_exists( $dirname ) ) @@ -88,7 +87,7 @@ */ foreach($array_delete AS $key=>$value) { - linImport::deleteEntry( $key, $dirname.$value); + linImport::deleteEntry( $key, $dirname.'/'.$value); } /** @@ -107,38 +106,38 @@ } elseif($value{0} == '.') { - //linSysLog('hidden'); + linSysLog("File ".$dirname.'/'.$value." Is Hidden<br />"); } elseif( in_array( $value, linImport::getIgnoreFilelist() ) ) { - //linSysLog('ignore'); + linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); } elseif( in_array($ext, linImport::getIgnoreFileext() ) ) { - //linSysLog('ignore'); + linSysLog("File ".$dirname.'/'.$value." Is In The Ignore List<br />"); } - elseif( !is_readable( $dirname.$value) ) + elseif( !is_readable( $dirname.'/'.$value) ) { - //linSysLog('not readable'); + linSysLog("File ".$dirname.'/'.$value." Is Not Readable<br />"); } /** * no need for is_link as links are detected correctly * with is_file, is_dir and is_readable ! - * elseif( is_link ($name.'/'.$value ) ) + * elseif( is_link ($dirname.'/'.$value ) ) { linSysLog('link'); }*/ - elseif( is_file( $dirname.$value ) ) + elseif( is_file( $dirname.'/'.$value ) ) { linImport::addNewFile( $parent_id, $dirname , $value ); } - elseif( is_dir( $dirname.$entry ) ) + elseif( is_dir( $dirname.'/'.$entry ) ) { linImport::addNewDir( $parent_id, $dirname , $value , $recursive); } else { - linSysLog('Error: what am i? '.$dirname.$entry.'<br />'); + linSysLog('Error: what am i? '.$dirname.'/'.$entry.'<br />'); } } @@ -172,53 +171,49 @@ */ function addNewFile( $parent_id , $dirname , $filename ) { - linSysLog('new file '.$dirname.$filename.'<br />'); + linSysLog('new file '.$dirname.'/'.$filename.'<br />'); - list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize($dirname.$filename); - if( linIdentify::isVideo($org_type) OR linIdentify::isSupportedImage($org_type)) - { - /** - * 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($org_type) ) - { - $md5sum = md5($dirname.'/'.$filename); - } - elseif( linIdentify::isSupportedImage($org_type) ) - { - $md5sum = md5_file($dirname.'/'.$filename); - } - - - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . - "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . - "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . - "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); + list($org_width,$org_height,$org_type) = linIdentify::linGetImageSize($dirname.'/'.$filename); - /** - * delete thumbnail if one exists with the same id - */ - $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); - linImage::deleteThumbnail($inserted_id); - - /** - * update number of photos - */ - linImport::updateNumberPhotos( $parent_id ); + /** + * 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($org_type) ) + { + $md5sum = md5($dirname.'/'.$filename); } + elseif( linIdentify::isSupportedImage($org_type) ) + { + $md5sum = md5_file($dirname.'/'.$filename); + } else { - linSysLog("Omitting not supported file or broken image: " . - "<b>".$filename."</b> (Reported type: ".$org_type.")<br />"); + $md5sum = ''; } + + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos ( " . + "parent_id , name, img_type , md5sum , time_add , time_mod , stats_numbers ) " . + "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', " . + "'".$org_type."' , '".$md5sum."', '".time()."', '".time()."', '1' )"); + + /** + * delete thumbnail if one exists with the same id + */ + $inserted_id = $GLOBALS['linpha']->db->Insert_ID(); + linImage::deleteThumbnail($inserted_id); + + /** + * update number of photos + */ + linImport::updateNumberPhotos( $parent_id ); } @@ -231,7 +226,7 @@ */ function addNewDir( $parent_id , $dirname , $filename , $recursive) { - linSysLog('new dir '.$dirname .$filename.'<br />'); + linSysLog('new dir '.$dirname .'/'.$filename.'<br />'); $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos " . "( parent_id , img_type , name , time_add , time_mod )" . @@ -246,7 +241,7 @@ if($recursive) { - linImport::addNewSubEntry( $inserted_id , $dirname.$filename.'/' , $recursive); + linImport::addNewSubEntry( $inserted_id , $dirname.'/'.$filename , $recursive); } } @@ -280,7 +275,7 @@ { linSysLog('ignore'); } - elseif( !is_readable( $dirname.$entry) ) + elseif( !is_readable( $dirname.'/'.$entry) ) { linSysLog('not readable'); } @@ -290,11 +285,11 @@ { echo 'link'; }*/ - elseif( is_file( $dirname.$entry ) ) + elseif( is_file( $dirname.'/'.$entry ) ) { linImport::addNewFile( $parent_id, $dirname , $entry ); } - elseif( is_dir( $dirname.$entry ) ) + elseif( is_dir( $dirname.'/'.$entry ) ) { linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -56,13 +56,9 @@ include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); $sql_dir = ''; - /** - * @todo get /var value from config table - */ - include_once(LINPHA_DIR.'/var/config.dir.php'); - $include_file = linFilesys::getFullPath( $sql_dir ).'config.sql.php'; + $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) { include_once( $include_file ); @@ -87,12 +83,12 @@ { if(isset($_SESSION['installmode1'])) { - $sql_dir = linFilesys::getFullPath($_SESSION['sql_dir']); - $GLOBALS['linpha']->db->Connect($sql_dir.'database.sqlite'); + $sql_dir = LinFilesys::getFullPath($_SESSION['sql_dir']); + $GLOBALS['linpha']->db->Connect($sql_dir.'/database.sqlite'); } else { - $GLOBALS['linpha']->db->Connect(LINPHA_DIR."/"."$sql_dir".'database.sqlite'); + $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/database.sqlite'); } break; } @@ -148,7 +144,7 @@ */ if( ! isset($_SESSION['installmode2']) ) { - $this->config = new linSqlConfig(); + $this->config = new LinSqlConfig(); } } // end function dbConnect @@ -406,16 +402,17 @@ /** * returns the correct path to the albums directory + * pay attention to use this getPath and not access directly 'sys_path_album_dir' ! */ function getPath($what) { $path = $GLOBALS['linpha']->sql->config->value['sys_path_'.$what.'_dir']; - return linFilesys::getFullPath( $path ); + return LinFilesys::getFullPath( $path ); } function getCachePath($what,$id) { - $path = linSql::getPath('cache'); + $path = LinSql::getPath('cache'); if(strlen($id)==1) { @@ -426,7 +423,7 @@ $subdir = substr($id,0,2); } - return $path . $what .'/' .$subdir .'/'.$id .'.jpg'; + return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; } } // end class linSql @@ -435,7 +432,7 @@ /** * sub-class linSqlConfig */ -class linSqlConfig +class LinSqlConfig { public $value; Modified: trunk/linpha2/lib/modules/module.albums.php =================================================================== --- trunk/linpha2/lib/modules/module.albums.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/lib/modules/module.albums.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -73,7 +73,7 @@ "WHERE img_type = '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); $array_files = $GLOBALS['linpha']->db->GetAssoc("SELECT id, name, img_type, stats_numbers, time_add FROM ".PREFIX."photos " . - "WHERE img_type <> '0' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); + "WHERE img_type <> '0' AND img_type <> '9999999' AND parent_id = '".$linpha->imgview->id_parent."' ORDER by ".$order_by); $linpha->imgview->photos = array_merge($array_folders,$array_files); Modified: trunk/linpha2/templates/default/css/view_thumb.css =================================================================== --- trunk/linpha2/templates/default/css/view_thumb.css 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/templates/default/css/view_thumb.css 2006-04-01 11:09:56 UTC (rev 4467) @@ -1,5 +1,5 @@ #main { -/* min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ + min-height: 500px; /*@todo floated divs in thumb view without javascript doesnt count to the main div height */ } /** Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-04-01 09:31:00 UTC (rev 4466) +++ trunk/linpha2/templates/default/home.html.php 2006-04-01 11:09:56 UTC (rev 4467) @@ -47,7 +47,7 @@ . '<img class="img_folder_thumbnail" src="'. LINPHA_DIR.'/get_thumb.php?id=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> <div class='div_folder_text'> - <h2><?php echo $value['name']; ?></h2> + <h2><?php echo '<a href="'.LINPHA_DIR.'/?cat=alb&id='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> <?php echo $value['stats_numbers'].' '.i18n("Photos"); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |