Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource interpreted as image but transferred with MIME type text/html - Magento

Tags:

php

magento

I'm getting below error when uploading a new product image for my Magento shop.

Resource interpreted as image but transferred with MIME type text/html

Is there a reason why this is happening?

like image 501
Jae Kun Choi Avatar asked Nov 08 '11 21:11

Jae Kun Choi


3 Answers

This might well occur if your image path is set incorrectly. For example relative to current directory "images/myimage.gif" vs relative to web root "/images/myimage.gif".

The reference to "text/html" might suggest you have an error being returned by the server.

like image 91
Ian Lewis Avatar answered Oct 17 '22 01:10

Ian Lewis


I noticed this problem appearing in my JavaScript Console log. It was a simple case of a CSS file looking for a background image that didn't exist and the server sending a 404 error message in its place.

like image 12
stevecomrie Avatar answered Oct 17 '22 01:10

stevecomrie


One needs to serve the images with the proper MIME type -

Add this line into the .htaccess file (assuming it's apache2 httpd):

AddType image/gif .gif

hint: mod_rewrite might require an exclusion for images:

RewriteCond %{REQUEST_URI} !\.(png|gif|jpg)$
RewriteRule ...

... everything else might be 404 indeed.

like image 5
Martin Zeitler Avatar answered Oct 17 '22 00:10

Martin Zeitler