fixes #2377 add 3XL and 4XL derivatives

This commit is contained in:
HWFord
2025-06-26 12:35:03 +02:00
parent 8f3adbda79
commit b825f45537
6 changed files with 44 additions and 3 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ function parse_request()
{
ierror('Invalid crop', 400);
}
$greatest = ImageStdParams::get_by_type(IMG_XXLARGE);
$greatest = ImageStdParams::get_by_type(IMG_4XLARGE);
$key = array();
$params->add_url_tokens($key);
+5 -1
View File
@@ -20,6 +20,8 @@ define('IMG_MEDIUM', 'medium');
define('IMG_LARGE', 'large');
define('IMG_XLARGE', 'xlarge');
define('IMG_XXLARGE', 'xxlarge');
define('IMG_3XLARGE', '3xlarge');
define('IMG_4XLARGE', '4xlarge');
define('IMG_CUSTOM', 'custom');
@@ -53,7 +55,7 @@ final class ImageStdParams
/** @var string[] */
private static $all_types = array(
IMG_SQUARE, IMG_THUMB, IMG_XXSMALL, IMG_XSMALL, IMG_SMALL,
IMG_MEDIUM, IMG_LARGE, IMG_XLARGE, IMG_XXLARGE
IMG_MEDIUM, IMG_LARGE, IMG_XLARGE, IMG_XXLARGE, IMG_3XLARGE, IMG_4XLARGE
);
/** @var DerivativeParams[] */
private static $all_type_map = array();
@@ -214,6 +216,8 @@ final class ImageStdParams
IMG_LARGE => new DerivativeParams( SizingParams::classic(1008,756) ),
IMG_XLARGE => new DerivativeParams( SizingParams::classic(1224,918) ),
IMG_XXLARGE => new DerivativeParams( SizingParams::classic(1656,1242) ),
IMG_3XLARGE => new DerivativeParams( SizingParams::classic(2232,1674) ),
IMG_4XLARGE => new DerivativeParams( SizingParams::classic(3000,2250) ),
);
$now = time();
foreach($arr as $params)
+33
View File
@@ -0,0 +1,33 @@
<?php
// +-----------------------------------------------------------------------+
// | This file is part of Piwigo. |
// | |
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
global $conf;
load_conf_from_db();
$upgrade_description = 'Add 3XL and 4XL sizes';
//Get predefined image sizes
$derivatives = unserialize($conf['derivatives']);
//get default sizes from derivative_std_params
$default_sizes = ImageStdParams::get_default_sizes();
//Get 3XL and 4XL from default values
$derivatives['d'][IMG_3XLARGE] = $default_sizes['3xlarge'];
$derivatives['d'][IMG_4XLARGE] = $default_sizes['4xlarge'];
// Save derivative new settings
ImageStdParams::set_and_save($derivatives['d']);
echo "\n".$upgrade_description."\n";
?>
+2
View File
@@ -516,3 +516,5 @@ $lang['This API key was manually revoked on %s'] = 'This API key was manually re
$lang['Edit API Key'] = 'Edit API Key';
$lang['Do you really want to revoke the "%s" API key?'] = 'Do you really want to revoke the "%s" API key?';
$lang['To manage your API keys, please log in with your username/password.'] = 'To manage your API keys, please log in with your username/password.';
$lang['3xlarge'] = '3XL - extra huge';
$lang['4xlarge'] = '4XL - gigantique';
+2
View File
@@ -515,3 +515,5 @@ $lang['This API key was manually revoked on %s'] = 'Cette clé API a été révo
$lang['Edit API Key'] = 'Modifier la clé API';
$lang['Do you really want to revoke the "%s" API key?'] = 'Voulez-vous vraiment révoquer la clé API "%s" ?';
$lang['To manage your API keys, please log in with your username/password.'] = 'Pour gérer vos clés API, veuillez vous connecter avec votre nom d\'utilisateur/mot de passe.';
$lang['3xlarge'] = '3XL - très énorme';
$lang['4xlarge'] = '4XL - gigantesque';
+1 -1
View File
@@ -173,7 +173,7 @@ function ws_addDefaultMethods( $arr )
array_merge(array(
'types' => array('default'=>null,
'flags'=>WS_PARAM_FORCE_ARRAY,
'info'=>'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge'),
'info'=>'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge, 3xlarge, 4xlarge'),
'ids' => array('default'=>null,
'flags'=>WS_PARAM_FORCE_ARRAY,
'type'=>WS_TYPE_ID),