TinyPNG
Forum Replies Created
-
Hi,
@dillonlara115 thank you for your patience on this matter. We have released a new WordPress plugin version that should resolve the problem that you experience.
Please upgrade to version 3.6.6 and let us know if it resolves the problem.
Hi @dillonlara115!
Thanks for reporting this. We investigated the issue and found the cause: when images were converted and replaced in html, the page builder could fail to load due to the picture-element replacement feature. We have implemented a fix. When Avada is detected, the plugin now automatically disables picture-element replacement. You can also manually resolve this by turning off Picture Replacement in the plugin settings. This fix is included in version 3.6.5, released yesterday. If you still run into anything, please let us know.
Forum: Plugins
In reply to: [TinyPNG - JPEG, PNG & WebP image compression] 3.6.4 Not Properly Escaping JSHaha no worries!
Forum: Plugins
In reply to: [TinyPNG - JPEG, PNG & WebP image compression] Blank page with Bricks BuilderHi there,
Thanks for reaching out! We haven’t yet tested the compatibility between the latest Bricks update (2.1.4) and TinyPNG 3.6.4. We need to run some tests on our end to replicate this conflict and see exactly what is breaking the builder. We will investigate this thoroughly and provide you with a concrete update next week.
Forum: Plugins
In reply to: [TinyPNG - JPEG, PNG & WebP image compression] PHP Warning – php81Hi there!
Thanks for reaching out and sharing the warning message. These notices appear when the plugin receives invalid or unexpected attachment metadata. In most cases, because another plugin is altering the output of the wp_get_attachment_metadata filter and returning something other than the expected array. It’s worth checking your other plugins (especially anything media-related) to see if one of them is modifying this metadata.
That said, we have an update coming in version 3.6.4 that adds extra defensive checks to prevent this warning from appearing, even if another plugin returns invalid data.
Hi there!
Thanks for getting in touch! If you install the plugin, it will automatically compress newly uploaded images. Since your existing images were already compressed on our website, you should not use the bulk optimization tool, as it would recompress them unnecessarily.
If there are a few older images that still need compression, you can manually select just those. This guide shows how to do that: https://help.tinify.com/help/how-to-compress-existing-images-with-plugin
Hope this helps!
We understand the need to get the modern alternative so that you can replace the urls yourself. Unfortunately, there is no public method to get the modern format. If you need the modern alternative to a given image url, you can mimic the function you referenced. Hopefully that works out like you intended!
We will let you know once server side content negotiation is available, which could provide a smoother experience if your server setup allows it.
Hi again,
Thanks for checking in! The update you’ve been waiting for has been released as part of version 3.6.3. You can now start using the filter, and here’s some documentation to help you get started:
https://github.com/tinify/wordpress-plugin/blob/master/docs/hooks/tiny_replace_with_picture.mdLet us know how it goes, we’d love to hear your feedback!
Forum: Plugins
In reply to: [TinyPNG - JPEG, PNG & WebP image compression] WebP Srcset GenerationHi there,
We’re sorry to hear you’re experiencing some quality issues. We’d be happy to look into this for you. Could you please email us at [email protected] and let us know which Tinify account you’re using?
Thanks for your input! We’ll be adding a basic filter for picture generation, you can expect it the week after.
Cheers!Hi @juntodigital ,
Thanks for the detailed explanation! That makes perfect sense.
Right now, the plugin leaves all attributes on the <img> element as-is and doesn’t try to interpret them for <source>. That’s why in setups like SplideJS, the <picture> element can override the intended lazy-load behavior.
You’re right that a simple add_filter(‘tinypng_generate_picture’, ‘__return_false’) could solve this by giving theme authors full control. The trade-off is that disabling <picture> means the browser will load the original JPG/PNG instead of the optimized WebP/AVIF version. For some setups that’s fine, and we understand the need for that flexibility.
We’re considering two paths forward:
Adding a filter so developers can disable <picture> generation entirely, or possibly whitelist/blacklist specific images.
Longer term, adding support for server-side content negotiation (via Apache/Nginx rules), which would solve this automatically without requiring HTML changes. That feature is planned for later this year as it needs thorough testing.
Would the simple filter already solve your use case for now, or would you prefer to wait for the server-side approach?
Thanks again for sharing this valuable feedback.
Hi @ajaykasam1,
Thanks for reaching out! You can manually choose which images to compress. I recommend checking out this guide that walks you through the process step by step:
– https://help.tinify.com/help/how-to-compress-existing-images-with-pluginI hope this information is useful!Forum: Reviews
In reply to: [TinyPNG - JPEG, PNG & WebP image compression] I always use it!Thank you so much for the 5-star review! We’re thrilled to hear you always use our plugin 🙂
Hi there!
Good point!
If you can run this script (instructions are in the file) from the root of the WordPress installation it should be solved.<?php
/**
* Small script that can be passed to wp eval. It will loop over
* every attachment, read the file size on disk and write the tinify
* meta data so that it looks compressed. This will ensure the plug-in
* will not pick it up for compression.
*
* This file should be stored in root directory of the WordPress installation
*
* usage:
* wp eval-file tinify_mark_compressed.php
*
*/
if ( ! defined( 'ABSPATH' ) ) {
// If running via wp-cli from project root:
require_once __DIR__ . '/wp-load.php';
}
$all = get_posts([
'post_type' => 'attachment',
'post_mime_type' => ['image/jpeg', 'image/png', 'image/webp'],
'posts_per_page' => -1,
'fields' => 'ids',
]);
$upload = wp_upload_dir();
foreach ($all as $ID) {
$wp_meta = wp_get_attachment_metadata($ID);
if (! is_array($wp_meta) || empty($wp_meta['file'])) {
continue;
}
$basedir = trailingslashit($upload['basedir']) . dirname($wp_meta['file']) . '/';
$tiny_meta = [];
// Original (size key = 0)
$orig_file = $basedir . basename($wp_meta['file']);
if (file_exists($orig_file)) {
$sz = filesize($orig_file);
$tiny_meta[0] = [
'input' => ['size' => $sz],
'output' => ['size' => $sz],
];
}
// All intermediate sizes
if (! empty($wp_meta['sizes']) && is_array($wp_meta['sizes'])) {
foreach ($wp_meta['sizes'] as $size_name => $info) {
$f = $basedir . $info['file'];
if (! file_exists($f)) {
continue;
}
$sz = filesize($f);
$tiny_meta[$size_name] = [
'input' => ['size' => $sz],
'output' => ['size' => $sz],
];
}
}
if (empty($tiny_meta)) {
// No files found so skipping
continue;
}
update_post_meta($ID, 'tiny_compress_images', $tiny_meta);
}Please let us know if you run into any trouble with this.
We’re glad to hear that you’re happy with the service!