Closed alanquigley closed 10 years ago
Yes, it occurred to me that it wouldn't work for images as resource, however, they'll be cached when embedded on in a webpage.
I'll have to wrap my head around this and tweak the image response.
Thanks for your response, I'm not sure I fully understand the issue. Can you recommend a workaround?
http cacheing seems to be broken for generic response types, I'll have to fix it first.
Just noticed something, I was looking at the image Response in Charles, seems that each one has a laravel error page attached to its bottom when viewed as raw.
Hm, that's interesting. Does it occur on direct resource calls or just when calling multiple images on a page?
There's something else I can't get to work properly. Actually the browser requests the connection to stay alive but somehow the connection get closed, even when I explicitly set the response headers.
However, if you're able to use the xsend response type, caching will work (although not because of my implementation but because of some internal x-sendfile apache caching I guess)
ok, got it working now. Will push a update asap.
I've just pushed and update and http caching seems to work fine now. I'll need some more testing though. Will release a new version soon.
https://gist.github.com/basesignal/7768947
Thats the error page attached to the bottom of the image file, seems like it returns the image and immediately redirects.
Something else I've noticed:
AbstractFileResponse.php line 88 $this->etags never seems to get set.
Ill happily test the fix if you want, thanks:)
Just updated, whats happening is every second request fails
to be honest, this is not very useful
have you properly set up your environment variable in Laravel? And in the jitimage config?
As far as I can see everything is configured correctly.
Hm, you probably still have an old version since etags is gone https://github.com/iwyg/jitimage/blob/master/src/Thapp/JitImage/Response/AbstractFileResponse.php#L88
Configuring my server to use x-sendfile, hopfully this will get it working.
Installing thapp/jitimage (dev-master 024f350) - Seems to be the most recent.
If encountered something quite similar. If there's a large set of images, chrome wouldn't render them all. In fact, observing the ones that are not rendered there's no response at all. This happens only if cache is disabled in devtools , the first time the page is rendered, or the jjitimage cache is fresh (aka with a 200 status). It happens with all response types and file drivers. But it hasn't anything to do with Jitimage. It's a chrome thing and I don't know why. It works on every other browser I've been testing.
Same thing with opera. Since they're also using blink now, this seems to confirm my theory.
Ha!, nailed it!
Can you try the latest commit?
Also please be sure your environment is set up properly in /app/bootstrap.start.php
And also clear the image cache php artisan jitimage:clearcache
e.g.
// /app/bootstrap.start.php
$env = $app->detectEnvironment(array(
'local' => array('your-machine-name'),
'development' => array('*.dev'),
'production' => array('*.com'),
));
which should correspond to the environments you want't images to be cached:
// /app/config/packages/thapp/jitimage/config.php
'cache' => [
'environments' => ['production', 'development', 'foo']
]
Just installed it. Same results I'm afraid, loads first time and then when it loads the second time it crashes
I've check the bootstrap variables all seem fine, clear the server cache.
Is the above link working on any browser for you?
Images loaded using the facade do seem to work!!
/jit/storage/6bbd4aa2/jit_d8c69e73937cf892.jpg
JitImage::source($person->portrait->original)->cropAndResize(333, 192, 5)
Looking good!! seems like its working. That was above and beyond the call. Thanks for sorting this out.
You're welcome :)
HTTP/1.1 200 OK Date: Mon, 02 Dec 2013 16:17:22 GMT Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0-fips mod_bwlimited/1.4 X-Powered-By: PHP/5.4.21 Cache-Control: no-cache, public ETag: "97630a98d645cc66026101280d977913" Cache-Control: max-age=2592000 Expires: Wed, 01 Jan 2014 16:17:22 GMT X-UA-Compatible: IE=edge Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: image/jpeg