From 8e098d502a8f0e413b9c085db27d6a62a6c0909f Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 3 Dec 2015 16:04:02 +0100 Subject: 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 --- include/functions.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 60a1885e5..e1658c31f 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -952,6 +952,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 * -- cgit v1.2.3