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
Use an optional image dimensions cache #25
Conversation
You should not add new methods to a stable interface, probably use a CacheableImageInterface? Or maybe the methods dont need to be in the interface because they are not supposed to be used externally (except for dependency injection). |
Also, being only dependency injection would mean that the component can run with or without cache, which I think is a cool feature. But it needs a readme 😉 |
I think this should not be a problem if we release a new version 0.4.0.
That would have the benefit to make the cache support for an implementor of the
The image library itself doesn’t create a cache, so the methods have to be used externally to make use of a cache.
That’s the case already.
I will add :) |
77d94a7
to
b94e962
Compare
That's not a problem IMHO:
|
I don't understand that. If I do not setter-inject an image dimensions cache, the |
Take a look at Resizer.php:147 for example, it expects that If such a case happens in the future, going with a new interface would be the only option because of BC. But we don’t yet have to be BC with this library IMO. |
The resizer uses the concrete class, so it knows the method is there. The interface is for injection and methods to use, setting the cache layer is not relevant for that. |
On that line: Resizer.php:147 |
An alternative from @aschempp: Remove I think this could be a better solution and more flexible for future additions. |
@contao/developers what do you think about the |
I like it. |
This is not the way we want to go, see contao/core-bundle#626 (comment) |
A single request in Contao causes many (hundreds) calls to
Image::getDimensions()
, e.g. for every icon shown on a backend page. A cache for the dimensions off all images would be a big performance boost.@contao/developers does this implementation make sense that way?
If yes, I can make a pull request to the core-bundle to use the cache there.