From c08fa6f67ef5b149fdeb3bcc57045e629df8fff4 Mon Sep 17 00:00:00 2001 From: plegall Date: Sat, 4 Mar 2006 23:31:46 +0000 Subject: new feature: source/destination links between categories. Will we keep this feature? Code is complicated and very few people will understand how it works... modification: #images.storage_category_id replaced by #image_category.is_storage improvement: many code refactoring to improve readibility improvement: virtual category creation code was moved to a dedicated function in order to be called from admin/cat_list.php and admin/cat_modify.php (create a new destination category) git-svn-id: http://piwigo.org/svn/trunk@1064 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/site_reader_local.php | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'admin/site_reader_local.php') diff --git a/admin/site_reader_local.php b/admin/site_reader_local.php index fc31aaec8..23161d2e2 100644 --- a/admin/site_reader_local.php +++ b/admin/site_reader_local.php @@ -44,11 +44,20 @@ function LocalSiteReader($url) function open() { global $errors; + if (!is_dir($this->site_url)) { - array_push($errors, array('path' => $this->site_url, 'type' => 'PWG-ERROR-NO-FS')); + array_push( + $errors, + array( + 'path' => $this->site_url, + 'type' => 'PWG-ERROR-NO-FS' + ) + ); + return false; } + return true; } @@ -135,8 +144,11 @@ function get_elements($path) function get_update_attributes() { global $conf; - $update_fields = array( 'has_high', 'representative_ext', - 'filesize', 'width', 'height' ); + + $update_fields = array( + 'has_high', 'representative_ext', 'filesize', 'width', 'height' + ); + if ($conf['use_exif']) { $update_fields = @@ -154,6 +166,7 @@ function get_update_attributes() array_keys($conf['use_iptc_mapping']) ); } + return $update_fields; } @@ -169,9 +182,13 @@ function get_element_update_attributes($file) $data = array(); $filename = basename($file); - $data['has_high'] = $this->get_has_high( dirname($file), $filename ); - $data['representative_ext'] = $this->get_representative_ext( dirname($file), - get_filename_wo_extension($filename) ); + + $data['has_high'] = $this->get_has_high(dirname($file), $filename); + + $data['representative_ext'] = $this->get_representative_ext( + dirname($file), + get_filename_wo_extension($filename) + ); $data['filesize'] = floor(filesize($file)/1024); if ($image_size = @getimagesize($file)) @@ -204,6 +221,7 @@ function get_element_update_attributes($file) } } } + return $data; } @@ -212,8 +230,7 @@ function get_element_update_attributes($file) function get_representative_ext($path, $filename_wo_ext) { global $conf; - $base_test = $path.'/pwg_representative/'; - $base_test.= $filename_wo_ext.'.'; + $base_test = $path.'/pwg_representative/'.$filename_wo_ext.'.'; foreach ($conf['picture_ext'] as $ext) { $test = $base_test.$ext; @@ -228,8 +245,10 @@ function get_representative_ext($path, $filename_wo_ext) function get_tn_ext($path, $filename_wo_ext) { global $conf; - $base_test = $path.'/thumbnail/'; - $base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.'; + + $base_test = + $path.'/thumbnail/'.$conf['prefix_thumbnail'].$filename_wo_ext.'.'; + foreach ($conf['picture_ext'] as $ext) { $test = $base_test.$ext; @@ -238,6 +257,7 @@ function get_tn_ext($path, $filename_wo_ext) return $ext; } } + return null; } @@ -247,6 +267,7 @@ function get_has_high($path, $filename) { return 'true'; } + return null; } -- cgit v1.2.3