From b495ada8320e2193235054d9ec391834144f2a6c Mon Sep 17 00:00:00 2001 From: MrRaph_ Date: Thu, 22 May 2025 19:25:56 +0000 Subject: [PATCH] reverted changes --- wp-thumbor.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/wp-thumbor.php b/wp-thumbor.php index 8900077..4d5c5bc 100644 --- a/wp-thumbor.php +++ b/wp-thumbor.php @@ -240,8 +240,7 @@ function wp_thumbor_transform_url($url, $width = null, $height = null) { // Détermine l'endpoint : si une clé secrète est renseignée, on signe, sinon on utilise "unsafe" if ( ! empty($options['thumbor_secret_key']) ) { $hmac = hash_hmac('sha1', $path_to_sign, $options['thumbor_secret_key'], true); - // on enlève aussi les '=' de padding pour que Thumbor accepte la signature - $encoded_signature = rtrim(strtr(base64_encode($hmac), '+/', '-_'), '='); + $encoded_signature = strtr(base64_encode($hmac), '+/', '-_'); $endpoint = $encoded_signature; } else { $endpoint = 'unsafe'; @@ -298,15 +297,7 @@ function wp_thumbor_output_buffer_callback($buffer) { foreach ( $srcsetItems as $item ) { $parts = preg_split('/\s+/', trim($item)); if ( ! empty($parts[0]) && preg_match('/^https?:\/\//', $parts[0]) ) { - $width = null; - $height = null; - if ( isset($parts[1]) && preg_match('/^(\d+)w$/i', $parts[1], $m) ) { - $width = intval($m[1]); - } elseif ( isset($parts[1]) && preg_match('/^(\d+)h$/i', $parts[1], $m) ) { - $height = intval($m[1]); - } - $newURL = wp_thumbor_transform_url($parts[0], $width, $height); - + $newURL = wp_thumbor_transform_url($parts[0]); $newSrcset[] = isset($parts[1]) ? $newURL . ' ' . $parts[1] : $newURL; } else { $newSrcset[] = $item;