dimanche 12 avril 2015

Writing "application/octet-stream" content type response as image/jpeg

Here is what I'm trying to do, which is failing in one case only -




  1. Get the remote image via file_get_contents().




  2. The response content type is coming up as "application/octet-stream".




  3. Write the image into temp directory, Now the saved image is coming up as "application/octet-stream" content type rather than image/jpeg, while the original url is image.




  4. Using imagecreatefromstring() returns false with binary data, setting headers is not making any difference.




This is how response headers looks -



Cache-Control:public
Cache-Control:max-age=315360000
Content-Encoding:gzip
Content-Type:image%2Fjpeg; charset=ISO-8859-1
Date:Mon, 13 Apr 2015 06:22:03 GMT
Expires:Thu, 31 Dec 2037 23:55:55 GMT
Last-Modified:Fri, 10 Apr 2015 02:14:42 GMT
Server:nginx
Transfer-Encoding:chunked
Vary:Accept-Encoding
x-cache-hit:True


Any thoughts ?


Aucun commentaire:

Enregistrer un commentaire