khashnan / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

MIME type wrongly stripped #195

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In function mime_type (around line 468) this is done:

$mime_type = str_replace ('image/', '', $mime_type);

if ($mime_type == 'jpeg') {
    $mime_type = 'jpg';
}

I'm sure there's a very good reason for that; I just don't seem to get it. 
Isn't the "image/" part necessary for the MIME type? Why would one want to 
strip that out?

Also, for a JPEG image this would report "jpg" as the MIME type which is wrong 
(it should be "image/jpeg").

See http://en.wikipedia.org/wiki/Internet_media_type#Type_image

Original issue reported on code.google.com by matthias...@gmail.com on 8 Jun 2011 at 1:12

GoogleCodeExporter commented 8 years ago
Note: I discovered that through Safari's Web Inspector, it reported the 
generated images as transmitted with a wrong MIME type.

Original comment by matthias...@gmail.com on 8 Jun 2011 at 1:14

GoogleCodeExporter commented 8 years ago
Thanks for the info - the data is stripped to simplify some of the code 
elsewhere. Calling that variable mime_type is possibly misleading.

However, if it is breaking the actual image mime_type header then that would 
need fixing. I'll look into it, should be straight forward to sort out :)

Thanks for the pointer

Original comment by BinaryMoon on 9 Jun 2011 at 2:22

GoogleCodeExporter commented 8 years ago

Original comment by BinaryMoon on 10 Jun 2011 at 6:21