aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-30 16:08:54 +0100
committerplegall <plg@piwigo.org>2015-12-30 16:08:54 +0100
commit6ba0148e646b2a193dc4111bb0a443d8c193e646 (patch)
tree382ecd35afae3522d07377df332f0ecfee1f5045 /admin/include/functions.php
parentf28420acfeb5d69e9ea39cd8d00cf9775d6cea54 (diff)
parent7b653c04d6cfb20366c3bb0e183a521b3c9d22d2 (diff)
Merge branch 'feature/379-multiple-format'
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r--admin/include/functions.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index fbbcd8c55..5ad436b71 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -180,6 +180,25 @@ function delete_element_files($ids)
}
$new_ids = array();
+ $formats_of = array();
+
+ $query = '
+SELECT
+ image_id,
+ ext
+ FROM '.IMAGE_FORMAT_TABLE.'
+ WHERE image_id IN ('.implode(',', $ids).')
+;';
+ $result = pwg_query($query);
+ while ($row = pwg_db_fetch_assoc($result))
+ {
+ if (!isset($formats_of[ $row['image_id'] ]))
+ {
+ $formats_of[ $row['image_id'] ] = array();
+ }
+
+ $formats_of[ $row['image_id'] ][] = $row['ext'];
+ }
$query = '
SELECT
@@ -205,6 +224,14 @@ SELECT
$files[] = original_to_representative( $files[0], $row['representative_ext']);
}
+ if (isset($formats_of[ $row['id'] ]))
+ {
+ foreach ($formats_of[ $row['id'] ] as $format_ext)
+ {
+ $files[] = original_to_format($files[0], $format_ext);
+ }
+ }
+
$ok = true;
if (!isset($conf['never_delete_originals']))
{
@@ -277,6 +304,13 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
;';
pwg_query($query);
+ // destruction of the formats
+ $query = '
+DELETE FROM '.IMAGE_FORMAT_TABLE.'
+ WHERE image_id IN ('. $ids_str .')
+;';
+ pwg_query($query);
+
// destruction of the links between images and tags
$query = '
DELETE FROM '.IMAGE_TAG_TABLE.'
@@ -540,6 +574,7 @@ function get_fs_directories($path, $recursive = true)
'.', '..', '.svn',
'thumbnail', 'pwg_high',
'pwg_representative',
+ 'pwg_format',
)
);
$exclude_folders = array_flip($exclude_folders);