aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 60a1885e5..2119abe8f 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -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').'
)
;';
@@ -953,6 +955,21 @@ function original_to_representative($path, $representative_ext)
}
/**
+ * 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
*
* @param array $element_info element information from db (at least 'path')