Avoid gzip on images with query string
|
02-14-2012, 04:22 AM
(This post was last modified: 02-14-2012 04:32 AM by Joel.)
Post: #1
|
|||
|
|||
Avoid gzip on images with query string
Hi,
I know it's not recommended to gzip images (not sure exactly why though) so I used this code in the httpd config file to gzip everything besides images Code: <Location /> Everything seems to be working fine, however; I just noticed that images with query strings (like /sample.php?id=123456.jpg) are in fact being gziped (See Results) is there any way I can filter these out? Thanks |
|||
02-14-2012, 11:12 PM
Post: #2
|
|||
|
|||
RE: Avoid gzip on images with query string
You shouldn't gzip images because they will actually end up larger - they are already compressed by algorithms at least as good as gzip.
I'm a little curious why you have gzip enabled on everything by default and then choose to disable it under certain circumstances. I'm used to seeing it enabled by mime type: Code: <IfModule mod_deflate.c> |
|||
02-15-2012, 02:32 AM
Post: #3
|
|||
|
|||
RE: Avoid gzip on images with query string
Thanks Pat,
I took the code from Apache.org thinking it's the best source... Thanks for the code, can this one be used as is in the httpd config file, or only in .htaccess? ![]() |
|||
02-16-2012, 12:12 AM
Post: #4
|
|||
|
|||
RE: Avoid gzip on images with query string
It should work fin in the httpd config file as well - http://httpd.apache.org/docs/2.2/mod/cor...lterbytype
|
|||
02-16-2012, 05:17 AM
Post: #5
|
|||
|
|||
RE: Avoid gzip on images with query string
using the code you wrote above didn't work first in httpd config, I changed its location to go after
Code: LoadModule deflate_module modules/mod_deflate.so Thanks |
|||
03-01-2012, 03:25 AM
(This post was last modified: 03-01-2012 03:35 AM by Joel.)
Post: #6
|
|||
|
|||
RE: Avoid gzip on images with query string
if I use the code you provided above; should a file like this "/sample.php?id=file-name.jpg" not be gzipped?
I tried it but it still gzips everything ![]() it's obviously not being treated like a regular jpg file, because if it was it would have not been gzipped even with my original code but live headers shows it as a regular image/jpeg any idea how to fix this? |
|||
03-06-2012, 04:45 AM
Post: #7
|
|||
|
|||
RE: Avoid gzip on images with query string
Any chance your php code is doing the gzip? Just stretching here because the sample I use doesn't gzip images when I use it but something else is going on since your images are being served from php.
|
|||
03-06-2012, 05:04 AM
Post: #8
|
|||
|
|||
RE: Avoid gzip on images with query string
we do not gzip with php, the images are in a folder like this /images/12345.jpg then being modified on the fly with php (adding watermark/resizing/etc.) and called with the php ?id=12345.jpg which serves the modified version
|
|||
03-10-2012, 04:03 AM
Post: #9
|
|||
|
|||
RE: Avoid gzip on images with query string
Are you sending the correct mime type in your php script?
Code: header("Content-type: image/jpeg"); |
|||
03-13-2012, 08:54 AM
Post: #10
|
|||
|
|||
RE: Avoid gzip on images with query string | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)