[5.x]: Asset Transforms Are Not Removed When An Asset is Replaced
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
We replaced an image asset using the asset manager but all entries that use the asset are still displaying the old image. This is because Craft is not deleting old images transforms. I've tried all cache clearing mechanisms and Craft will not delete old image transforms. Only manual deletion is successful.
Steps to reproduce
- Add an image asset to a matrix
- Create an entry using the matrix
- Use twig function tag to create an image tag and pass a transform via twig as well
- Upload an image
- Replace the previous image with a new image through the asset manager
Expected behavior
Craft should be deleting old images transforms when an asset is replaced, or when template caches are cleared
Actual behavior
The old image persists
Craft CMS version
5.3.6
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by reproducing the asset-manager replacement flow with a Twig image transform, then trace the asset replacement and transform-cleanup entry points. Done means replacing an image removes obsolete transforms, or clearing template caches does so, and affected entries display the new image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100