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

Caching across Controller and Twig #69

Open
jakenoble opened this issue Feb 20, 2015 · 2 comments
Open

Caching across Controller and Twig #69

jakenoble opened this issue Feb 20, 2015 · 2 comments

Comments

@jakenoble
Copy link

I have been having some major issues with the cache. Doing the following in a Controller

$imageFormatter->open($path)->zoomCrop(100,100)->jpeg()

Produces a .jpg file. But doing this in Twig produces a completely different file with the .jpeg extension

{{ web_image(path).zoomCrop(100, 100) }}

I would have thought both of these calls are the same, so any subsequent calls would not produce the same file again. But it does run the resize and crop again.

How can I stop this from happening? So that the cache is used and is useful across both Twig and the Controller?

@Gregwar
Copy link
Owner

Gregwar commented Feb 20, 2015

Hm, we should track this to understand what is really different
If the hash is different, the operation applied may look different to the Image handler, you could try dumping the array that is hashed by the Gregwar/Image class in both cases

@jakenoble
Copy link
Author

I looked at the array and I think the issue comes from the path. Using image or web_image produces two different paths, rightly, and therefore two different hashes and two different images. This is fine and would be hard to engineer around as one path is absolute and the other relative.

But that doesn't explain why sometimes it produced a .jpg file and other times a .jpeg file?

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

No branches or pull requests

2 participants