-
-
Notifications
You must be signed in to change notification settings - Fork 356
[LazyImage] Be friendlier with the path passed to data_uri_thumbnail() #342
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
Comments
hey @weaverryan 👋 I have couple remarks related to this functionality. First off, to get on the same page, the $image = $this->imageManager->make(file_get_contents($filename)); First off, if I have to believe the documentation of Internention's Image::make, the usage of Removing Therefor, I think the retrieval of the content should not be handled by the blurhash methods, and instead the content should be passed directly. In terms of twig, that would mean something like this: {% set imageData = readLocalFile('build/images/large.jpg') %}
<img src="{{ data_uri_thumbnail(imageData, 40, 30) }}
Let me know what you think 😄 |
This is also important for us, because the images passed to that function are assetized. So we currently jump through hoops like this to make it work:
|
Same thing for me, using This code:
Throws the following error:
|
Thank you for this issue. |
Hello? This issue is about to be closed if nobody replies. |
Closing since #1781 added a way to override the |
Hi!
The main usage of lazy image looks like this
The path passed to
data_uri_thumbnail()
(build/images/large.jpg
) is loaded simply viafile_get_contents('build/images/large.jpg')
. That seems to work for me... though not in my tests... and it feels "shaky" at best to pass in a non-absolute path.Possible solution: if the path to the file cannot be found, we try again using the "public" path. Basically, something like this:
It's a bit ugly, bit it would be much more useful. An alternative would be some sort of general-purpose Twig filter for this:
But, I'm not sure I love this, and that seems like something that belongs in Symfony itself.
The text was updated successfully, but these errors were encountered: