vendredi 30 janvier 2015

How to remove Gzip compression in php output file


Vote count:

0




In htaccess, gzip is enable for particular mime type and it not enable for images. But when read the image file in php and output a file it encode as gzip. In response, the content type is image/*. When I directly access a file, it not encode and but in php output, it become gzip compression. Please guide me, to solve this issue.


.htaccess



AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/plain \
text/x-component \
text/xml


Sample code of image.php



header("Content-Type: " . $mime_type);
header("Content-Length: $length");

$objectContent -> rewind();
$stream = $objectContent -> getStream();
$output = fopen("php://output", "w");
while (!feof($stream)) {
set_time_limit(0);
fwrite($output, fread($stream, 8192));
}
fclose($output);


Response in image.php



Content-Encoding gzip
Content-Type image/jpeg


Response in direct image url



Content-Type image/jpeg


asked 2 mins ago







How to remove Gzip compression in php output file

Aucun commentaire:

Enregistrer un commentaire