I'm using google app engine with Python and have a couple static .png image files but they are all being served with an "image/x-png" content-type. This is a problem when I use a browser like chrome and try to view these images as the content-type is unrecognized, which forces chrome to download it as binary, rather than displaying the image.
How can I make App Engine serve these with the proper "image/png" mime type?
A transparent background allows designers to embed graphics into other images rather easily without requiring more complicated steps in post editing. PNG is ideal for static images, logos, prints and other images with transparent background.
That means if you want to view a PNG file, you simply need to double-click it and it should open in the default viewer on your computer. You can also view a PNG file by dragging it into any web browser (or use CTRL + O to browse for the file and then open it in a browser).
Although they are usually larger in size than the equivalent JPEG image, PNG images have become quite popular on the Web and are fully supported by WordPress. You can insert a PNG image file into a WordPress blog post or page just as you would any other image.
Assuming you are using Java, this is specified normally in the mime-mapping
section in the web.xml
file. See eg here or here.
In your case, I'd try
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
In Python, it seems you should add some handler to your app.yaml
with the appropiate mime_type
, for example (replace with your own url
and static_dir
) :
handlers:
- url: /static/*.png
static_dir: static
mime_type: image/png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With