diff options
author | plegall <plg@piwigo.org> | 2015-12-03 16:04:02 +0100 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2015-12-03 16:04:02 +0100 |
commit | 8e098d502a8f0e413b9c085db27d6a62a6c0909f (patch) | |
tree | 04bdf84e30becac7b8ed7b0b98fa7696b9979d5e /admin/site_reader_local.php | |
parent | 27389102d1275cdefcaee9c5a4a93297fc797b8c (diff) |
feature #379 multiple format, step 1: add formats
* new table piwigo_image_format (each photo can have 0 to many formats)
* only compatible with synchronization for now. Formats must be in sub-directory pwg_format
* formats are visible on edition page only for now
Diffstat (limited to 'admin/site_reader_local.php')
-rw-r--r-- | admin/site_reader_local.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/admin/site_reader_local.php b/admin/site_reader_local.php index 7e618ca17..051e574a6 100644 --- a/admin/site_reader_local.php +++ b/admin/site_reader_local.php @@ -100,14 +100,19 @@ function get_elements($path) { $representative_ext = $this->get_representative_ext($path, $filename_wo_ext); } + + $formats = $this->get_formats($path, $filename_wo_ext); + $fs[ $path.'/'.$node ] = array( 'representative_ext' => $representative_ext, + 'formats' => $formats, ); } } else if (is_dir($path.'/'.$node) and $node != 'pwg_high' and $node != 'pwg_representative' + and $node != 'pwg_format' and $node != 'thumbnail' ) { $subdirs[] = $node; @@ -182,6 +187,32 @@ function get_representative_ext($path, $filename_wo_ext) return null; } +function get_formats($path, $filename_wo_ext) +{ + global $conf; + + $formats = array(); + + $base_test = $path.'/pwg_format/'.$filename_wo_ext.'.'; + + foreach ($conf['format_ext'] as $ext) + { + $test = $base_test.$ext; + + if (is_file($test)) + { + // $formats[] = array( + // 'ext' => $ext, + // 'filesize' => floor(filesize($file) / 1024), + // ); + + // we return a "/" splitted string instead of an array with 2 keys, to reduce memory usage + $formats[] = $ext.'/'.floor(filesize($test) / 1024); + } + } + + return $formats; +} } ?>
\ No newline at end of file |