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?
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?
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.
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.
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.
I had the same problem once, because of capitalization.
My Colleagues were working on a Mac and added some camel-cased files, but it showed up lowercased in CSS. This works fine on Mac, but I was working on Linux. Mac doesn't distinguish filenames having different cases but Linux does. Most servers out there run on Linux.
example:
epicimage.jpg !== EpicImage.jpg
Thanks to the Chrome Dev Tools, the problem could be found very easy. Simply clicking on the image url showed me our 404 page. Mystery solved :D
Please check extension of your image, whether the program used create the image labels its extension with capital letters or small letters, some servers read them different.
I checked out basically every similar question on StackOverflow trying to solve a similar issue.
After all the attempts at altering my htaccess file and inserting php head arguments, what fixed it for me was ...just changing the capitalization on the picture's name.
Ugh. (It was working fine in the same browser local-hosted, too... so of course I wouldn't think that was the issue initially.)
After a lot of research, I have found the problem is caused by a combination of things resulting in the server not knowing what type of document it is and getting mixed up between encoding types such as UTF-8 (or something like that)
So, in .htaccess, change the comments round so you have the following, giving a default character set of UTF-8.
############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead
#AddDefaultCharset Off
AddDefaultCharset UTF-8
This stopped the correct error shown in google (thank you mr google): "resource interpreted as image but transferred with mime type text/html"
And the made the images show up in other browsers (where there was no error shown).
My issue was with this line in the CSS
background-image: url('');
Which should have been:
background-image: none;
For me my path was set incorrectly relative to the css file that was trying to pull the image from that triggered the error in the console.
I had to go out 2 directories and then into the one that had my image.The .. before the slash brings you out of a directory. Each . brings you out one more directory.
ex. url (../Folder/ImagesFolder/image.gif)
If your image path and case-sensitive filename is set correctly, and if you can't modify your server's .htaccess file, encoding the SVG as a data URI is a front-end solution. css-tricks.com explains how: http://css-tricks.com/using-svg/
This happened with me when I was including SVG image via img tag. If you are including SVG image via tag you need to switch to Object tag instead:
<object type="image/svg+xml" data="imageFile.svg">
Test SVG Logo
</object>
For me, this mime type error showed only when testing Safari 4.05 per client requirements, and only in the console. Ultimately this was caused by Safari handling the javascript styling element.style.backgroundImage="url()";
ungracefully. Evidently, Safari was looking for that empty url, so per Strixy and stevecomrie, "none" is the better choice. This is essentially the same issue as noted above as near duplicate of Resource interpreted as other but transferred with MIME type text/javascript?, wherein a <script src="">
was the culprit.
For magento2 Users
If you have modified this file app/etc/di.xml with following
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
make sure the path string is Case Sensitive (CaseSensitive for non Windows OS)
If you are facing 404 errors after magento2 Install in Ubuntu.
Install and Enable rewrite module
a2enmod rewrite
Then Edit
/etc/apache2/sites-available/000-default.conf
Add following lines at the End
<Directory "/var/www/html">
AllowOverride All
</Directory>
Maybe images didn't have read permission
I also got this problem, when i use TinyPNG to compress images, i got this error message "Resource interpreted as Image but transferred with MIME type text/html". Then i add images permission, it works.
image is sent with wrong headers, add headers to image type via .htaccess