Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagehelper - filename (towebp, tojpg) #2556

Open
wants to merge 4 commits into
base: 1.x
Choose a base branch
from
Open

Conversation

EpicKau
Copy link

@EpicKau EpicKau commented Mar 14, 2022

Fixes #897

Issue

files are not deleted, when they were generated through timber filter. (webp, png)

Solution

Change generated filenames to have target fileformat in the filename.
Added more calls to delete_generated_files with specific regex for fileformat

I hope it helps.

@jarednova
Copy link
Member

Thanks so much @EpicKau ! It looks like some tests need to be updated to match with this new naming convention. Could you give it a look?

@EpicKau
Copy link
Author

EpicKau commented Mar 17, 2022

@jarednova So what I see is that most time the test failed because of "assertFileExists" check. ("Failed asserting that file "XYZ" exists.")
That makes sense because the output file has another name than the input file.
E.g. XYZ-tojpg.jpg instead of XYZ.jpg.

@jarednova
Copy link
Member

jarednova commented Mar 17, 2022

Exactly @EpicKau (at least, that's what it looks like) — just need to reflect the new expected naming convention

jarednova
jarednova previously approved these changes Mar 25, 2022
@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 92.301% when pulling ffc3b39 on EpicKau:master into 68bb27b on timber:master.

@Levdbas
Copy link
Member

Levdbas commented May 25, 2023

So I ran into this issue #2748 as well and found this PR after some digging. #2535 seems to be related as well.

I did some local tests and this pr fixes both problems for me. both the webp and and jpg generated images are removed.

Only files that are not accounted for are when running towebp and tojpg on crops that will result to filenames like these.

test-400x267-towebp.webp
test-400x267-tojpg.jpg

Copy link
Member

@gchtr gchtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, websites that use the ToJpg and ToWebp operations will be left with quite a few stray webp and jpg images.

Do we have to consider this as a breaking change? Because I see the following problems here:

  • It will trigger the images to be regenerated and for sites with a lot of images, right? This could create performance issues or even max execution time errors.
  • It might have serious impact on the whole size of the website, which could lead to problems on websites that have a limited available space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants