timmy
timmy copied to clipboard
How do you handle derivative image path pattern(s)
Hi, sorry for the support issue. I'm switching to Timmy and formalize my thumbnail size but hit a couple of issues.
I've an hundred of posts referencing derivative images (whether within ACF whether in the post_content). All these will break as a soon as I switch to Timmy (and regenerate thumbnails / purge old derivative files) because the filename pattern changes from, eg, image-A-300x252.png to image-A-300x0-c-default.png.
- It's far from future-proof, how do you handle this situation?
- Do you know about existing WP bugreports related to this (and the lack of an intermediary and height/width-agnostic representation of inlined images)?
- Is there a foolproof method/hook to store derivative images in completely different
uploadsubfolder (to make identification of their references within the database easier)? - And if yes, would you think using the format name instead of actual dimension for filename could be a realistic way to solve this, eg,
image-A-medium.png?
Hey Raphaël!
No worries! I’m actually amazed there aren’t more support questions.
About your questions:
- Unfortunately, I’ve never a had a case like yours. But I’d like to make this work. Can you make more concrete examples for the images that break in the post content as well as for ACF? I would like to replicate this, so I can think about a solution.
- No, I don’t. But I didn’t go and dig in the trac tickets, either. What do you mean with «lack of an intermediary height/width-agnostic representation of inlined images»?
- Timmy relies on Timber’s resize function. I never tried to change the folders or filenames of the generated files, because apparently (from seeing a lot of issues in Timber) this leads to a lot special cases that need to be catched and handled separately. It’s far from foolproof and very fragile. I guess image handling in Timber could be improved. But there’s so much to consider. It’s really hard to come up with a solution that benefits everyone.
- We would have to explore this further. A benefit of the dimensions in the filename is that you can change dimensions and don’t have to regenerate all thumbnails, because the new size is generated on the fly. A downside is that you end up with invalid image sizes, so you would have to regenerate images anyway.