this can be convenient for inlining images. the filter should accept a variable containing a binary string, a stream resource and maybe also just a filename.
Probably a binding to this lib is a good way ? https://github.com/alchemy-fr/PHP-dataURI
@nlegoff This is for you
(mime-type detection is missing)
for mime-type detection you can check this Symfony2 classes/code:
you are right. i tested this:
Be carefull, your implementation does not check the string length to comply with RFC 2397 section 2 https://www.ietf.org/rfc/rfc2397.txt
Here's my implementation, based on PHP-dataURI
RFC 1866 Hypertext Markup Language - 2.0 November 1995
The `NAMELEN' parameter in the SGML declaration (9.5, "SGML Declaration for HTML") limits the length of an attribute value to 1024 characters.
BC can be overdone :)
and except for mixing datatypes, i like your solution...
for this feature in the core!