Merge branch 'feature/379-multiple-format'

This commit is contained in:
plegall
2015-12-30 16:08:54 +01:00
15 changed files with 440 additions and 18 deletions
+7
View File
@@ -63,6 +63,13 @@ $conf['file_ext'] = array_merge(
array('tiff', 'tif', 'mpg','zip','avi','mp3','ogg','pdf')
);
// enable_formats: should Piwigo search for multiple formats?
$conf['enable_formats'] = false;
// format_ext : file extensions for formats, ie additional versions of a
// photo (or nay other file). Formats are in sub-directory pwg_format.
$conf['format_ext'] = array('cr2', 'tif', 'tiff', 'nef', 'dng', 'ai', 'psd');
// top_number : number of element to display for "best rated" and "most
// visited" categories
$conf['top_number'] = 15;
+2
View File
@@ -105,5 +105,7 @@ if (!defined('THEMES_TABLE'))
define('THEMES_TABLE', $prefixeTable.'themes');
if (!defined('LANGUAGES_TABLE'))
define('LANGUAGES_TABLE', $prefixeTable.'languages');
if (!defined('IMAGE_FORMAT_TABLE'))
define('IMAGE_FORMAT_TABLE', $prefixeTable.'image_format');
?>
+18 -1
View File
@@ -407,7 +407,7 @@ SELECT id, name
* @param string $image_type
* @return bool
*/
function pwg_log($image_id = null, $image_type = null)
function pwg_log($image_id = null, $image_type = null, $format_id = null)
{
global $conf, $user, $page;
@@ -445,6 +445,7 @@ INSERT INTO '.HISTORY_TABLE.'
category_id,
image_id,
image_type,
format_id,
tag_ids
)
VALUES
@@ -457,6 +458,7 @@ INSERT INTO '.HISTORY_TABLE.'
'.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').',
'.(isset($image_id) ? $image_id : 'NULL').',
'.(isset($image_type) ? "'".$image_type."'" : 'NULL').',
'.(isset($format_id) ? $format_id : 'NULL').',
'.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').'
)
;';
@@ -952,6 +954,21 @@ function original_to_representative($path, $representative_ext)
return substr_replace($path, $representative_ext, $pos+1);
}
/**
* Transforms an original path to its format
*
* @param string $path
* @param string $format_ext
* @return string
*/
function original_to_format($path, $format_ext)
{
$pos = strrpos($path, '/');
$path = substr_replace($path, 'pwg_format/', $pos+1, 0);
$pos = strrpos($path, '.');
return substr_replace($path, $format_ext, $pos+1);
}
/**
* get the full path of an image
*