aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-09-17 21:03:58 +0000
committerplegall <plg@piwigo.org>2011-09-17 21:03:58 +0000
commitfafb6c336848dcd5955ba3165054f405b8e6d347 (patch)
treeae27eadafb0b89eb4a614f3a88bdf3950a913b67
parent3e9f0d74abb745de7ab5248435aa3d1767233b43 (diff)
feature 2441 added: no need to have the HD to regenerate the websize if the
current websize is bigger than resize settings. When it occurs, we move the current websize as HD and create the new websize from it. git-svn-id: http://piwigo.org/svn/trunk@12175 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl3
-rw-r--r--include/ws_functions.inc.php37
-rw-r--r--language/cs_CZ/admin.lang.php1
-rw-r--r--language/de_DE/admin.lang.php1
-rw-r--r--language/en_UK/admin.lang.php3
-rw-r--r--language/es_ES/admin.lang.php1
-rw-r--r--language/fr_FR/admin.lang.php3
-rw-r--r--language/he_IL/admin.lang.php1
-rw-r--r--language/hu_HU/admin.lang.php1
-rw-r--r--language/it_IT/admin.lang.php1
-rw-r--r--language/lv_LV/admin.lang.php1
-rw-r--r--language/nl_NL/admin.lang.php1
-rw-r--r--language/pl_PL/admin.lang.php1
-rw-r--r--language/ru_RU/admin.lang.php1
-rw-r--r--language/sk_SK/admin.lang.php1
-rw-r--r--language/sr_RS/admin.lang.php1
-rw-r--r--language/sv_SE/admin.lang.php1
-rw-r--r--language/tr_TR/admin.lang.php1
-rw-r--r--language/vi_VN/admin.lang.php1
-rw-r--r--language/zh_CN/admin.lang.php1
20 files changed, 40 insertions, 22 deletions
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index 70ebc137f..080d7ea5f 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -738,7 +738,8 @@ jQuery(window).load(function() {
<div id="action_regenerateWebsize" class="bulkAction">
<p>
<img src="admin/themes/default/icon/warning.png" alt="!" style="vertical-align:middle;">
- {'Only photos with HD can be regenerated!'|@translate}
+ {'By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'|@translate}
+ {'If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.'|@translate}
</p>
<table style="margin:10px 20px;">
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 61f655d23..8355ff760 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -2962,7 +2962,7 @@ function ws_images_resizewebsize($params, &$service)
include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
$query='
-SELECT id, path, tn_ext, has_high
+SELECT id, path, tn_ext, has_high, width, height
FROM '.IMAGES_TABLE.'
WHERE id = '.(int)$params['image_id'].'
;';
@@ -2974,12 +2974,43 @@ SELECT id, path, tn_ext, has_high
}
$image_path = $image['path'];
- $hd_path = get_high_path($image);
- if (empty($image['has_high']) or !file_exists($hd_path) or !is_valid_image_extension(get_extension($image_path)))
+ if (!is_valid_image_extension(get_extension($image_path)))
{
return new PwgError(403, "image can't be resized");
}
+
+ $hd_path = get_high_path($image);
+
+ if (empty($image['has_high']) or !file_exists($hd_path))
+ {
+ if ($image['width'] > $params['maxwidth'] or $image['height'] > $params['maxheight'])
+ {
+ $hd_path = file_path_for_type($image_path, 'high');
+ $hd_dir = dirname($hd_path);
+ prepare_directory($hd_dir);
+
+ rename($image_path, $hd_path);
+ $hd_infos = pwg_image_infos($hd_path);
+
+ single_update(
+ IMAGES_TABLE,
+ array(
+ 'has_high' => 'true',
+ 'high_filesize' => $hd_infos['filesize'],
+ 'high_width' => $hd_infos['width'],
+ 'high_height' => $hd_infos['height'],
+ ),
+ array(
+ 'id' => $image['id']
+ )
+ );
+ }
+ else
+ {
+ return new PwgError(403, "image can't be resized");
+ }
+ }
$result = false;
$img = new pwg_image($hd_path, $params['library']);
diff --git a/language/cs_CZ/admin.lang.php b/language/cs_CZ/admin.lang.php
index 11bc04cb8..491850627 100644
--- a/language/cs_CZ/admin.lang.php
+++ b/language/cs_CZ/admin.lang.php
@@ -802,7 +802,6 @@ $lang['%s thumbnails have been regenerated'] = '%s náhledů bylo regenerováno'
$lang['%s thumbnails can not be regenerated'] = '%s náhledů nemohlo být regenerováno';
$lang['%s photos have been regenerated'] = '%s fotek bylo regenerováno';
$lang['%s photos can not be regenerated'] = '%s fotek nemohlo být regenerováno';
-$lang['Only photos with HD can be regenerated!'] = 'Pouze fotky s vysokým rozlišením mohou být regenerovány!';
$lang['Updates'] = 'Aktualizace';
$lang['Update in progress... Please wait.'] = 'Probíhá aktualizace... Prosím čekejte.';
$lang['Ignore this update'] = 'Ignoruj tuto aktualizaci';
diff --git a/language/de_DE/admin.lang.php b/language/de_DE/admin.lang.php
index d86ab5b60..40a50391e 100644
--- a/language/de_DE/admin.lang.php
+++ b/language/de_DE/admin.lang.php
@@ -790,7 +790,6 @@ $lang['Regenerate Websize Photos'] = 'Neuerstellung web-optimierter Fotos';
$lang['Photos generation in progress...'] = 'Fotos werden neu erstellt...';
$lang['%s photos have been regenerated'] = '%s Fotos wurden neu erstellt';
$lang['%s photos can not be regenerated'] = '%s Fotos konnten nicht neu erstellt werden';
-$lang['Only photos with HD can be regenerated!'] = 'Diese Erweiterung berücksichtigt nur HD Material!';
$lang['new'] = 'neu';
$lang['No results'] = 'Keine Ergebnisse';
$lang['Searching...'] = 'Suche...';
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index fd05c61ec..6a3140634 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -801,7 +801,6 @@ $lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenera
$lang['%s thumbnails can not be regenerated'] = '%s thumbnails can not be regenerated';
$lang['%s photos have been regenerated'] = '%s photos have been regenerated';
$lang['%s photos can not be regenerated'] = '%s photos can not be regenerated';
-$lang['Only photos with HD can be regenerated!'] = 'Only photos with HD can be regenerated!';
$lang['Updates'] = 'Updates';
$lang['Update in progress... Please wait.'] = 'Update in progress... Please wait.';
@@ -859,4 +858,6 @@ $lang['Tags <em>%s</em> merged into tag <em>%s</em>'] = 'Tags <em>%s</em> merged
$lang['Select at least two tags for merging'] = 'Select at least two tags for merging';
$lang['Learn more'] = 'Learn more';
$lang['Select an album'] = 'Select an album';
+$lang['By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'] = 'By default, Piwigo will create a new websize from the HD (high definition) version of your photo.';
+$lang['If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.'] = 'If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.';
?>
diff --git a/language/es_ES/admin.lang.php b/language/es_ES/admin.lang.php
index 870840b93..c75749a73 100644
--- a/language/es_ES/admin.lang.php
+++ b/language/es_ES/admin.lang.php
@@ -786,7 +786,6 @@ $lang['Regenerate Websize Photos'] = 'Volver a generar las fotos tamaño web';
$lang['Photos generation in progress...'] = 'Generación de las fotos en curso...';
$lang['%s photos have been regenerated'] = '%s fotos fueron regeneradas.';
$lang['%s photos can not be regenerated'] = '%s fotos no pueden ser regeneradas';
-$lang['Only photos with HD can be regenerated!'] = 'Sólo las fotos de alta definición pueden ser regeneradas';
$lang['display'] = 'Visualizar';
$lang['Type in a search term'] = 'Introduce un término de búsqueda';
$lang['new'] = 'nuevo';
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index d103887b6..0f6d00b12 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -800,7 +800,6 @@ $lang['%s thumbnails have been regenerated'] = '%s miniatures ont été régén
$lang['%s thumbnails can not be regenerated'] = '%s miniatures ne peuvent pas être régénérées';
$lang['%s photos have been regenerated'] = '%s photos ont été régénérées';
$lang['%s photos can not be regenerated'] = '%s photos ne peuvent pas être régénérées';
-$lang['Only photos with HD can be regenerated!'] = 'Seules les photos avec HD peuvent être régénérées';
$lang['Updates'] = 'Mises à jour';
$lang['Update in progress... Please wait.'] = 'Mise à jour en cours... Veuillez patienter.';
@@ -870,4 +869,6 @@ $lang['Average rate'] = 'Note moyenne';
$lang['Rate'] = 'Note';
$lang['Learn more'] = 'En savoir plus';
$lang['Select an album'] = 'Selectionnez un album';
+$lang['By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'] = 'Par défaut, Piwigo créera la nouvelle taille web à partir de la HD (haute définition).';
+$lang['If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.'] = 'Si la HD n\'est pas disponible et que la version actuelle de la taille web est plus grande que les dimensions ci-dessous, alors Piwigo la considérera comme HD et créera la nouvelle taille web à partir de celle-ci.';
?> \ No newline at end of file
diff --git a/language/he_IL/admin.lang.php b/language/he_IL/admin.lang.php
index 169536a99..d4c5ca9c0 100644
--- a/language/he_IL/admin.lang.php
+++ b/language/he_IL/admin.lang.php
@@ -812,7 +812,6 @@ $lang['%s thumbnails have been regenerated'] = '%s תמונות ממוזערות
$lang['%s thumbnails can not be regenerated'] = '%s תמונות ממוזערות לא יכלו להתחדש';
$lang['%s photos have been regenerated'] = '%s תמונות חודשו';
$lang['%s photos can not be regenerated'] = '%s תמונות לא יכלו להתחדש';
-$lang['Only photos with HD can be regenerated!'] = 'רק תמונות HD יכולות להתחדש!';
$lang['Updates'] = 'עדכונים';
$lang['Update in progress... Please wait.'] = 'עדכון בתהליך... המתן.';
$lang['Ignore this update'] = 'התעלם מעידכון זה';
diff --git a/language/hu_HU/admin.lang.php b/language/hu_HU/admin.lang.php
index 52a834d98..76cd9152a 100644
--- a/language/hu_HU/admin.lang.php
+++ b/language/hu_HU/admin.lang.php
@@ -798,7 +798,6 @@ $lang['Regenerate Websize Photos'] = 'Web méretű képek újragenerálása';
$lang['Photos generation in progress...'] = 'Képek újragenerálása folyamatban...';
$lang['%s photos have been regenerated'] = '%s kép újragenerálva';
$lang['%s photos can not be regenerated'] = '%s képet nem lehet újragenerálni';
-$lang['Only photos with HD can be regenerated!'] = 'Csak HD képeket lehet újragenerálni!';
$lang['Updates'] = 'Frissítések';
$lang['Update in progress... Please wait.'] = 'Frissítés folyamatban... Kérem várjon.';
$lang['Ignore this update'] = 'Hagyja figyelmen kívül';
diff --git a/language/it_IT/admin.lang.php b/language/it_IT/admin.lang.php
index c1dd79d78..7210bec03 100644
--- a/language/it_IT/admin.lang.php
+++ b/language/it_IT/admin.lang.php
@@ -800,7 +800,6 @@ $lang['%s thumbnails have been regenerated'] = '%s miniature sono state rigenera
$lang['%s thumbnails can not be regenerated'] = '%s miniature non possono essere rigenerate';
$lang['%s photos have been regenerated'] = '%s foto sono state rigenerate';
$lang['%s photos can not be regenerated'] = '%s foto non possono essere rigenerate';
-$lang['Only photos with HD can be regenerated!'] = 'Solo le foto con una HD possono essere rigenerate';
$lang['Updates'] = 'Aggiornamento';
$lang['Update in progress... Please wait.'] = 'Aggiornamento in corso ... Attendere prego';
diff --git a/language/lv_LV/admin.lang.php b/language/lv_LV/admin.lang.php
index 5ff682288..d64f1c88f 100644
--- a/language/lv_LV/admin.lang.php
+++ b/language/lv_LV/admin.lang.php
@@ -781,7 +781,6 @@ $lang['Regenerate Websize Photos'] = 'Reģenerēt Webizmēra Fotogrāfijas';
$lang['Photos generation in progress...'] = 'Notiek foto izveide...';
$lang['%s photos have been regenerated'] = 'izveidotas %s fotogrāfijas';
$lang['%s photos can not be regenerated'] = '%s fotogrāfijas nav iespējams reģenerēt';
-$lang['Only photos with HD can be regenerated!'] = 'Tikai HD kvalitātes fotogrāfijas iespējams reģenerēt!';
$lang['new'] = 'jauns';
$lang['No results'] = 'Nav rezultātu';
$lang['Searching...'] = 'Meklē...';
diff --git a/language/nl_NL/admin.lang.php b/language/nl_NL/admin.lang.php
index 0dd43a976..48a293b3b 100644
--- a/language/nl_NL/admin.lang.php
+++ b/language/nl_NL/admin.lang.php
@@ -789,7 +789,6 @@ $lang['Regenerate Websize Photos'] = 'Hergenereer webformaat foto\'s.';
$lang['Photos generation in progress...'] = 'Bezig met hergenereren foto\'s...';
$lang['%s photos have been regenerated'] = '%s foto\'s zijn hergegenereerd.';
$lang['%s photos can not be regenerated'] = '%s foto\'s konden niet opnieuw gegenereerd worden.';
-$lang['Only photos with HD can be regenerated!'] = 'Alleen foto\'s met HD kunnen opnieuw worden gegenereerd!';
$lang['display'] = 'toon';
$lang['new'] = 'nieuw';
$lang['No results'] = 'Geen resultaten';
diff --git a/language/pl_PL/admin.lang.php b/language/pl_PL/admin.lang.php
index 10adb691a..a6e13166c 100644
--- a/language/pl_PL/admin.lang.php
+++ b/language/pl_PL/admin.lang.php
@@ -799,7 +799,6 @@ $lang['%s thumbnails have been regenerated'] = 'Zostało stworzonych %s miniatur
$lang['%s thumbnails can not be regenerated'] = '%s miniatur nie mogło zostać stworzonych';
$lang['%s photos have been regenerated'] = 'Stworzono %s zdjęć';
$lang['%s photos can not be regenerated'] = '%s zdjęć nie mogło zostać stworzonych';
-$lang['Only photos with HD can be regenerated!'] = 'Tylko zdjęcia HD mogą być ponownie utworzone!';
$lang['Updates'] = 'Aktualizacje';
$lang['Update in progress... Please wait.'] = 'Trwa aktualizacja... Proszę czekać.';
$lang['Ignore this update'] = 'Ignoruj tę aktualizację';
diff --git a/language/ru_RU/admin.lang.php b/language/ru_RU/admin.lang.php
index 4eb84992d..5cb37e6ae 100644
--- a/language/ru_RU/admin.lang.php
+++ b/language/ru_RU/admin.lang.php
@@ -798,7 +798,6 @@ $lang['%s thumbnails have been regenerated'] = '%s миниатюр было с
$lang['%s thumbnails can not be regenerated'] = '%s миниатюр не было создано заново';
$lang['%s photos have been regenerated'] = '%s фотографий было создано заново';
$lang['%s photos can not be regenerated'] = '%s фотографий не было создано заново';
-$lang['Only photos with HD can be regenerated!'] = 'Только фотографии с HD могут быть созданы заново!';
$lang['Updates'] = 'Обновление';
$lang['Update in progress... Please wait.'] = 'Процесс обновления... Пожалуйста, подождите.';
$lang['Ignore this update'] = 'Пропустить это обновление';
diff --git a/language/sk_SK/admin.lang.php b/language/sk_SK/admin.lang.php
index 31517186d..7a1665dac 100644
--- a/language/sk_SK/admin.lang.php
+++ b/language/sk_SK/admin.lang.php
@@ -791,7 +791,6 @@ $lang['Regenerate Websize Photos'] = 'Zlepšenie web veľkostí fotografií';
$lang['Photos generation in progress...'] = 'Prebieha tvorba fotografií...';
$lang['%s photos have been regenerated'] = '%s fotografií bolo vytvorených';
$lang['%s photos can not be regenerated'] = '%s fotografií nebolo vytvorených';
-$lang['Only photos with HD can be regenerated!'] = 'Len forografie v HD môžu byť vytvorené!';
$lang['new'] = 'nové';
$lang['No results'] = 'Bez výsledkov';
$lang['Searching...'] = 'Vyhľadávam...';
diff --git a/language/sr_RS/admin.lang.php b/language/sr_RS/admin.lang.php
index ca1c274c4..950461e46 100644
--- a/language/sr_RS/admin.lang.php
+++ b/language/sr_RS/admin.lang.php
@@ -801,7 +801,6 @@ $lang['%s thumbnails have been regenerated'] = 'Број сличица који
$lang['%s thumbnails can not be regenerated'] = 'Број сличица који се не може регенерисати: %s';
$lang['%s photos have been regenerated'] = 'Број регенерисаних фотографија: %s';
$lang['%s photos can not be regenerated'] = 'Број фотографија који се не може регенерисати: %s';
-$lang['Only photos with HD can be regenerated!'] = 'Само фотографије у HD могу бити регенерисане!';
$lang['Updates'] = 'Унапређење';
$lang['Update in progress... Please wait.'] = 'У току је унапређење... Молимо Вас да сачеката.';
$lang['Ignore this update'] = 'Занемари ово унапређење';
diff --git a/language/sv_SE/admin.lang.php b/language/sv_SE/admin.lang.php
index 6e425fedb..f6130ecc3 100644
--- a/language/sv_SE/admin.lang.php
+++ b/language/sv_SE/admin.lang.php
@@ -787,7 +787,6 @@ $lang['Regenerate Websize Photos'] = 'Skapa Web storleks bilder';
$lang['Photos generation in progress...'] = 'Bild generering pågår..';
$lang['%s photos have been regenerated'] = '%s foton har skapats';
$lang['%s photos can not be regenerated'] = '%s foton har inte skapats';
-$lang['Only photos with HD can be regenerated!'] = 'Endast foton med HD kan regenereras!';
$lang['new'] = 'ny';
$lang['No results'] = 'Inga poster hittades';
$lang['Searching...'] = 'Söker...';
diff --git a/language/tr_TR/admin.lang.php b/language/tr_TR/admin.lang.php
index a740d4920..c63c6c504 100644
--- a/language/tr_TR/admin.lang.php
+++ b/language/tr_TR/admin.lang.php
@@ -783,7 +783,6 @@ $lang['Regenerate Websize Photos'] = 'Yeniden web boyutu oluştur';
$lang['Photos generation in progress...'] = 'Resimler oluşturulmaya devam ediyor...';
$lang['%s photos have been regenerated'] = '%s resimler oluşturuldu';
$lang['%s photos can not be regenerated'] = '%s resimler oluşturulamadı';
-$lang['Only photos with HD can be regenerated!'] = 'Sadece HD olan resimler oluşturulabilir!';
$lang['new'] = 'yeni';
$lang['No results'] = 'Sonuç yok';
$lang['Searching...'] = 'Arıyor...';
diff --git a/language/vi_VN/admin.lang.php b/language/vi_VN/admin.lang.php
index 2cb263f06..6fdbd98e7 100644
--- a/language/vi_VN/admin.lang.php
+++ b/language/vi_VN/admin.lang.php
@@ -787,7 +787,6 @@ $lang['Regenerate Websize Photos'] = 'Khởi tạo Ảnh Web';
$lang['Photos generation in progress...'] = 'Quá trình khởi tạo ảnh web đang được thực hiện...';
$lang['%s photos have been regenerated'] = 'có %s ảnh đã được tạo ra';
$lang['%s photos can not be regenerated'] = 'Có %s ảnh không thể tạo ra được';
-$lang['Only photos with HD can be regenerated!'] = 'Chỉ có những ảnh định dạng cao mới có thể được khởi tạo!';
$lang['new'] = 'mới';
$lang['No results'] = 'Không có kết quả nào';
$lang['Searching...'] = 'Đang tìm kiếm...';
diff --git a/language/zh_CN/admin.lang.php b/language/zh_CN/admin.lang.php
index cbba57f4e..744ba4d64 100644
--- a/language/zh_CN/admin.lang.php
+++ b/language/zh_CN/admin.lang.php
@@ -800,7 +800,6 @@ $lang['%s thumbnails have been regenerated'] = '%s 缩略图已被生成';
$lang['%s thumbnails can not be regenerated'] = '%s 缩略图不能被生成';
$lang['%s photos have been regenerated'] = '%s 相片已被生成';
$lang['%s photos can not be regenerated'] = '%s 相片不能被生成';
-$lang['Only photos with HD can be regenerated!'] = '只有高清相片才可被生成!';
$lang['Update in progress... Please wait.'] = '正在更新... 请稍等.';
$lang['Ignore this update'] = '忽略此更新';
$lang['Reset ignored updates'] = '重置忽略更新';