diff --git a/readme.txt b/readme.txt index efcd949..9bd6b02 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://tinypng.com/ Tags: compress images, compression, image size, page speed, performance Requires at least: 4.0 Tested up to: 6.8 -Stable tag: 3.6.2 +Stable tag: 3.6.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -174,6 +174,9 @@ A: You can upgrade to a paid account by adding your *Payment details* on your [a A: When the conversion feature is enabled (to convert images to AVIF or WebP), each image will use double the number of credits: one for compression and one for format conversion. == Changelog == += 3.6.3 = +* Changed the source priority for picture elements + = 3.6.2 = * Resolved an issue where the amount of parameters were incorrect when rendering a notice. diff --git a/src/class-tiny-picture.php b/src/class-tiny-picture.php index 0d2de81..fbb05ea 100644 --- a/src/class-tiny-picture.php +++ b/src/class-tiny-picture.php @@ -198,7 +198,7 @@ public function __construct( $html, $base_dir, $domains ) { $this->raw_html = $html; $this->base_dir = $base_dir; $this->allowed_domains = $domains; - $this->valid_mimetypes = array( 'image/webp', 'image/avif' ); + $this->valid_mimetypes = array( 'image/avif', 'image/webp' ); } protected static function get_attribute_value( $element, $name ) { @@ -405,15 +405,12 @@ class Tiny_Picture_Source extends Tiny_Source_Base { public function augment_picture_element() { $modified_sources = array(); - // handle existing sources - $optimized_types = [ 'image/webp', 'image/avif' ]; - foreach ( $this->get_element_by_tag( $this->raw_html, 'source' ) as $source_tag_html ) { $type_attr = self::get_attribute_value( $source_tag_html, 'type' ); $type_attr = null !== $type_attr ? strtolower( trim( $type_attr ) ) : ''; // Skip if already optimized. - if ( '' !== $type_attr && in_array( $type_attr, $optimized_types, true ) ) { + if ( '' !== $type_attr && in_array( $type_attr, $this->valid_mimetypes, true ) ) { continue; } diff --git a/src/class-tiny-plugin.php b/src/class-tiny-plugin.php index ce6f839..1dd7f73 100644 --- a/src/class-tiny-plugin.php +++ b/src/class-tiny-plugin.php @@ -18,7 +18,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ class Tiny_Plugin extends Tiny_WP_Base { - const VERSION = '3.6.0'; + const VERSION = '3.6.3'; const MEDIA_COLUMN = self::NAME; const DATETIME_FORMAT = 'Y-m-d G:i:s'; diff --git a/test/unit/TinyPictureTest.php b/test/unit/TinyPictureTest.php index 056c258..c974e07 100644 --- a/test/unit/TinyPictureTest.php +++ b/test/unit/TinyPictureTest.php @@ -199,7 +199,7 @@ public function test_adds_both_avif_and_webp() $this->wp->createImage(1000, '2025/01', 'test.avif'); $input = ''; - $expected = ''; + $expected = ''; $output = $this->tiny_picture->replace_sources($input); $this->assertEquals($expected, $output); diff --git a/tiny-compress-images.php b/tiny-compress-images.php index 55a264a..3b4bb6f 100644 --- a/tiny-compress-images.php +++ b/tiny-compress-images.php @@ -2,7 +2,7 @@ /** * Plugin Name: TinyPNG - JPEG, PNG & WebP image compression * Description: Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG. - * Version: 3.6.2 + * Version: 3.6.3 * Author: TinyPNG * Author URI: https://tinypng.com * Text Domain: tiny-compress-images