Comments (8)
I've run into the same issue, but with the caching part.
I've got a base image in png format
I've defined the format as jpg and when going through the controller, i get a file named png but it's a jpg with the correct mime type.
But this result file is saved to disk as .png and later calls just use the cached file so they return a jpg with png extension and filetype
As far as i can tell at the moment the browser "fixes" this, but it's bound to have an error somewhere...
from liipimaginebundle.
Can you elaborate a bit more?
Using this image:
https://github.com/liip/LiipHelloBundle/blob/query_param-proof-of-concept/Resources/public/images/image_test.jpg
And this template:
https://github.com/liip/LiipHelloBundle/blob/query_param-proof-of-concept/Resources/views/Hello/imagine.html.twig
I end up with:
http://screencast.com/t/zSnqMrldE
from liipimaginebundle.
I created a complete test case with a blank symfony: https://github.com/roderik/demoimagine
The test case contains your test image, once as PNG, once as JPG
I've created configs to create a 100x100 thumb for both these images, once with an output as jpg, once png
Configs are named so we can see what's what
Config: https://github.com/roderik/demoimagine/blob/master/app/config/config.yml
What i expect as cache files are:
jpgbase_pngresult: image_test.png
jpgbase_jpgresult: image_test.jpg
pngbase_pngresult: image_test.png
pngbase_jpgresult: image_test.jpg
What i actually get is
$ find web/uploads/cache -name image_test.* -exec file {} \;
web/uploads/cache/jpgbase_jpgresult/uploads/media/demoimages/image_test.jpg: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJ"
web/uploads/cache/jpgbase_pngresult/uploads/media/demoimages/image_test.jpg: PNG image data, 100 x 100, 8-bit/color RGBA, non-interlaced
web/uploads/cache/pngbase_jpgresult/uploads/media/demoimages/image_test.png: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJ"
web/uploads/cache/pngbase_pngresult/uploads/media/demoimages/image_test.png: PNG image data, 100 x 100, 8-bit/color RGBA, non-interlaced
The cache file is exactly the filename.ext as the base image
But the content of the file is the correct format.
So i have a image_test.png that is actually a jpg, and a image_test.jpg that is actually a png.
During the phase where the image is served through the controller, this is not a serious issue since the controller sets the correct content type. It only makes debugging harder.
During the phase where the url used in the html is the cached image, apache looks at the filename.ext and sends the wrong content type.
As far as we can tell at the moment, most browsers can handle this error, but its not really a good idea and has cost me a few hours debugging why my è§'('§ PNG was not becoming a JPG :)
from liipimaginebundle.
And yet, if you save the file (*.png with mime-type image/jpeg) to your harddisk, then some programs of my OS will not open it.
from liipimaginebundle.
can you check if #86 fixes the issue?
from liipimaginebundle.
Yes, this fixes it: https://github.com/roderik/demoimagine/commit/4095bb35045d4f018a7d6858ee008a04d0a8685b
I did have to edit Liip\ImagineBundle\DependencyInjection\LiipImagineExtension to the following to make it work in 2.0.15, there is only a Kernel::VERSION constant.
//if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {
$container->removeDefinition('liip_imagine.cache.clearer');
//}
thx!
from liipimaginebundle.
hmm are you sure about that issue with the kernel version? afaik it should work fine since 2.0.14
from liipimaginebundle.
ok, my bad, i accidently setup the test project with 2.0.10. Never mind me :)
from liipimaginebundle.
Related Issues (20)
- Drop support for unsupported dependencies in v3 HOT 2
- Separate OneupFlysystem and league/flysystem-bundle in the docs HOT 4
- Provide a simple demo repo HOT 1
- Add Provider Data/Path to 404 when creating images HOT 1
- Use s3 for cached images too HOT 3
- Redirect not working when resolving the first time HOT 5
- Document integration with backblaze adapter HOT 1
- help,how to override filter use programmatically HOT 2
- installation failure HOT 4
- $imagineCacheManager->resolve($image, $filter) doesn't generate file in controller HOT 9
- Bundle impossible to install or update HOT 3
- exif data not persisted in image HOT 1
- 2.12.2 autowiring of Imagine\Image\ImagineInterface broken HOT 2
- Regex in redirect optimization doc matches more than expected HOT 5
- Images are automatically rotated HOT 5
- bad yaml in documentation
- Resolve returning /cache even after :remove HOT 1
- leverage flysystem for all filesystems
- avif support HOT 3
- Hackathon for Version 3? HOT 1
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 liipimaginebundle.