Skip to content

Commit f53f00b

Browse files
Merge branch 'tinify:master' into master
2 parents e154eb9 + 5f2bd55 commit f53f00b

6 files changed

Lines changed: 44 additions & 3 deletions

File tree

bin/check-version

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ TAG_VERSION="${1:-${GITHUB_REF#refs/tags/}}"
99

1010
# Stable tag from readme.txt
1111
README_VERSION=$(grep -m 1 "^Stable tag:" readme.txt | awk '{print $3}')
12+
SOURCE_VERSION=$(grep "Version:" tiny-compress-images.php | head -n 1 | cut -d ':' -f 2 | xargs)
1213

1314
if [ "$TAG_VERSION" != "$README_VERSION" ]; then
1415
echo "Error: Tag: $TAG_VERSION, readme.txt: $README_VERSION"
1516
exit 1
1617
fi
1718

19+
if [ "$TAG_VERSION" != "$SOURCE_VERSION" ]; then
20+
echo "Error: Tag: $TAG_VERSION, tiny-compress-images.php: $SOURCE_VERSION"
21+
exit 1
22+
fi
23+
1824
echo "Version matches git release"

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://tinypng.com/
44
Tags: compress images, compression, image size, page speed, performance
55
Requires at least: 4.0
66
Tested up to: 6.9
7-
Stable tag: 3.6.11
7+
Stable tag: 3.6.12
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -174,6 +174,10 @@ A: You can upgrade to a paid account by adding your *Payment details* on your [a
174174
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.
175175

176176
== Changelog ==
177+
= 3.6.12 =
178+
* chore: updated tiny package to 1.6.4
179+
* fix: resolved warning when img tag was missing src attribute
180+
177181
= 3.6.9 =
178182
* fix: prevent picture element on product pages (WooCommerce)
179183

src/class-tiny-picture.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ private function filter_images( $content ) {
195195
}
196196
$images = array();
197197
foreach ( $matches[0] as $img ) {
198+
// Skip images without src or srcset
199+
if ( ! preg_match( '/\b(?:src|srcset)\s*=/i', $img ) ) {
200+
continue;
201+
}
198202
$images[] = new Tiny_Source_Image(
199203
$img,
200204
$this->base_dir,

src/class-tiny-source-base.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ protected function create_alternative_sources( $original_source_html ) {
189189
$srcsets = $this->get_image_srcsets( $original_source_html );
190190
if ( empty( $srcsets ) ) {
191191
// no srcset, try src attribute
192-
$srcsets[] = $this->get_image_src( $original_source_html );
192+
$src = $this->get_image_src( $original_source_html );
193+
if ( ! empty( $src ) ) {
194+
$srcsets[] = $src;
195+
}
193196
}
194197

195198
if ( empty( $srcsets ) ) {

test/unit/TinyPictureTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,28 @@ public function test_does_not_register_hooks_when_pagebuilder_request()
354354

355355
$_GET = array();
356356
}
357+
358+
/**
359+
* images that have no src or srcset will be unchanged
360+
*/
361+
public function test_image_without_src() {
362+
$input = '<img alt="no source">';
363+
$expected = '<img alt="no source">';
364+
$output = $this->tiny_picture->replace_sources($input);
365+
366+
$this->assertSame($expected, $output);
367+
}
368+
369+
/**
370+
* Images with only a srcset are valid and will be wrapped
371+
*/
372+
public function test_image_with_only_srcset() {
373+
$this->wp->createImage(37857, '2025/09', 'test_250x250.webp');
374+
375+
$input = '<img srcset="/wp-content/uploads/2025/09/test_250x250.png 350w" alt="no source but has srcset">';
376+
$expected = '<picture><source srcset="/wp-content/uploads/2025/09/test_250x250.webp 350w" type="image/webp" /><img srcset="/wp-content/uploads/2025/09/test_250x250.png 350w" alt="no source but has srcset"></picture>';
377+
$output = $this->tiny_picture->replace_sources($input);
378+
379+
$this->assertSame($expected, $output);
380+
}
357381
}

tiny-compress-images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: TinyPNG - JPEG, PNG & WebP image compression
44
* Description: Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG.
5-
* Version: 3.6.11
5+
* Version: 3.6.12
66
* Author: TinyPNG
77
* Author URI: https://tinypng.com
88
* Text Domain: tiny-compress-images

0 commit comments

Comments
 (0)