You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JPGs created from PNGs with a direct call to ImageHelper::img_to_jpg() should be deleted from the uploads directory when the original source PNG is deleted from the WordPress Media library.
Actual behaviour
The generated JPGs remain in the uploads directory.
Steps to reproduce behaviour
I am generating the JPGs via my PHP, not in my Twig templates, and returning the filenames of the newly created JPGs to the Timber context for later output inside a Twig template inside a <picture> tag:
Everything works perfectly including the resizing and format conversion, but the converted JPGs are not deleted when the original PNG is. If I try the same code using an original JPG, with no need to call ImageHelper::img_to_jpg() then the resized JPGs are correctly deleted when the original source JPG is deleted from the Media library. The problem seems to only occur when a file format conversion has happened.
Basically I've got all the same symptoms as this issue: #894 - but I'm converting the image type using ImageHelper::img_to_jpg() in the PHP rather than the |tojpg filter in Twig. I can see that I'm using a new enough Timber version that it includes the fixes from #894 and #897 but I haven't had any luck debugging TimberImageHelper::delete_generated_files.
If it helps, I've used Timber and my resize/convert code in the past on other sites (I think WP 5.7 or so) and had confirmed that the converted JPGs were correctly deleted - but it's failing for me on the latest versions of Timber and WordPress on my local as well as on WPEngine hosting.
Timber is superb btw, so thank you! :)
What version of WordPress, PHP and Timber are you using?
WordPress 5.9, PHP 7.4.1, Timber 1.19
How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
From Composer, via composer require wpackagist-plugin/timber-library
The text was updated successfully, but these errors were encountered:
4foot30
changed the title
img_to_jpg function doesn't delete JPGs generated from PNGs when original PNG is deleted
JPGs generated from PNGs by img_to_jpg function aren't deleted when original PNG is deleted
Feb 2, 2022
Expected behaviour
JPGs created from PNGs with a direct call to
ImageHelper::img_to_jpg()
should be deleted from the uploads directory when the original source PNG is deleted from the WordPress Media library.Actual behaviour
The generated JPGs remain in the uploads directory.
Steps to reproduce behaviour
I am generating the JPGs via my PHP, not in my Twig templates, and returning the filenames of the newly created JPGs to the Timber context for later output inside a Twig template inside a
<picture>
tag:Everything works perfectly including the resizing and format conversion, but the converted JPGs are not deleted when the original PNG is. If I try the same code using an original JPG, with no need to call
ImageHelper::img_to_jpg()
then the resized JPGs are correctly deleted when the original source JPG is deleted from the Media library. The problem seems to only occur when a file format conversion has happened.Basically I've got all the same symptoms as this issue: #894 - but I'm converting the image type using
ImageHelper::img_to_jpg()
in the PHP rather than the|tojpg
filter in Twig. I can see that I'm using a new enough Timber version that it includes the fixes from #894 and #897 but I haven't had any luck debuggingTimberImageHelper::delete_generated_files
.If it helps, I've used Timber and my resize/convert code in the past on other sites (I think WP 5.7 or so) and had confirmed that the converted JPGs were correctly deleted - but it's failing for me on the latest versions of Timber and WordPress on my local as well as on WPEngine hosting.
Timber is superb btw, so thank you! :)
What version of WordPress, PHP and Timber are you using?
WordPress 5.9, PHP 7.4.1, Timber 1.19
How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
From Composer, via
composer require wpackagist-plugin/timber-library
The text was updated successfully, but these errors were encountered: