-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Description
Hi everyone,
This is more of an RFC/question regarding LazyImage and file_get_contents.
I haven't yet attempted to use data_uri_thumbnail('https://...')
with an external image (let's say https://symfony.com/doc/6.2fr//the-fast-track/_images/infrastructure.png), but I assume it should work, leveraging file_get_contents.
However, here lies the issue: I'm not particularly fond of usingfile_get_contents
for downloading resources over HTTP. Even if we can use it, we're limited in configuring any options (e.g., proxy, authentication, timeout...).
I have two suggestions at the moment:
- Add support for PSR-7 and PSR-18. Inject a
Psr\Http\Client\ClientInterface
instance, and if we detect that $filename starts with https?://, we utilize the client to download the file. - Alternatively, create an abstraction over
file_get_contents
, with an interface and a default implementation usingfile_get_contents
. End-users can then use their own implementation, making it easier for us to implement and maintain on our side.
WDYT? Thanks!
Metadata
Metadata
Assignees
Labels
No labels