Comments (14)
👍 for this feature in the core!
from twig-extensions.
implemented in Twig core (see twigphp/Twig#3102)
from twig-extensions.
Probably a binding to this lib is a good way ? https://github.com/alchemy-fr/PHP-dataURI
@nlegoff This is for you
from twig-extensions.
(mime-type detection is missing)
from twig-extensions.
for mime-type detection you can check this Symfony2 classes/code:
from twig-extensions.
you are right. i tested this:
http://pastebin.com/Hi07BaEE
some drawbacks:
- class "MimeTypeGuesser" is a Singleton
- my webhoster disabled Fileinfo ext
- my webhoster disabled "passthru" method
- method "mime_content_type" is deprecated
- there is no posibility to catch the exception (\LogicException SPL?) cleanly (no code)
- in class File\File there is an protected "mime-type => extension" array ($defaultExtensions). with array_flip i might map this...
BUT:
in rfc2397 mime-type ([]) is optional. so it works entirely without mime-type or with text/plain... it doesnt matter :)
from twig-extensions.
Be carefull, your implementation does not check the string length to comply with RFC 2397 section 2 https://www.ietf.org/rfc/rfc2397.txt
from twig-extensions.
Here's my implementation, based on PHP-dataURI
https://github.com/romainneutron/TwigExtension-DataUri
from twig-extensions.
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...
from twig-extensions.
👍
from twig-extensions.
👍
from twig-extensions.
👍
from twig-extensions.
👍
from twig-extensions.
👍
from twig-extensions.
Related Issues (20)
- Variables in translation not escaped? HOT 10
- Deprecation Warning for Text.php & Fix HOT 1
- Translator decorator error in prod HOT 2
- Feature: Iterable test functions HOT 1
- Trans tag content with variables in them are broken for new versions of Twig.
- Attempted to load class "Twig_Extensions_Extension_Intl" HOT 1
- localized yes/no function for boolean value HOT 1
- Unexpected result of the localizeddate function HOT 1
- How to add IntlExtension with release 1.5.4 HOT 4
- Cannot combine form vars and filter HOT 5
- Please allow Twig 3 HOT 1
- Conflits with doctrine-bundle HOT 4
- Alternative for Date time_diff ? HOT 2
- Support Twig 3.0 HOT 1
- Support Symfony 5 HOT 3
- Php 7.4 preloading on v1.5.4 fails HOT 2
- [intl-extra] Japanese date format issue
- Mark as abandoned on packagist.org HOT 2
- What's the alternative solution for i18n translation which is supported by twig/twig-extension before and is not supported after upgrading to twig/twig:3 HOT 3
- Use GithubActions instead of Travis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twig-extensions.