Strange behavior with static .png file

167 views
Skip to first unread message

john

unread,
May 12, 2013, 9:22:40 PM5/12/13
to google-a...@googlegroups.com
I have some .png files in a directory that is configured as a static file handler. When I point my browser to the URL for any of the images, the result is not what I expect:
  • On Windows/Chrome, the image file is not displayed, but instead it is automatically downloaded.
  • On OSX/Chrome and OSX/Safari, a browser message indicates that a Quicktime plugin is needed. When I click the "Run this time" button, the Quicktime logo is displayed with a big question mark in it.
I have other GAE apps with static .png files that display in the browser as I expect. Can anyone help me figure out why this app doesn't? One URL which shows this behavior is http://calendar-ot.appspot.com/static/images/CalendarTools.png . For reference, I have pasted my app.yaml file to http://pastebin.com/dRZJZRd7 . 

timh

unread,
May 12, 2013, 11:22:14 PM5/12/13
to google-a...@googlegroups.com
Use headers plugin in chrome or wget to examine headers.  If it's being served with a content type of application/octet-stream it would normally be downloaded.

T

john

unread,
May 12, 2013, 11:43:50 PM5/12/13
to google-a...@googlegroups.com
Using curl:
Content-Type: image/x-png

john

unread,
May 13, 2013, 10:41:20 AM5/13/13
to google-a...@googlegroups.com
Yep, my problem stems from the fact that appengine is setting content type to image/x-png instead of image/png. Is anyone else seeing this with their image uploads? Why would appengine be doing this? I suppose a corollary question is why can't Chrome browser handle image/x-png type...

I know I can workaround things by creating a subdirectory for png files only -- so I can set the mime type explicitly -- but I really suspect there is something wrong in my setup or something else that I am missing.

Google Tasks Backup Moderator

unread,
May 14, 2013, 12:40:13 AM5/14/13
to google-a...@googlegroups.com
Is there any particular reason why you are trying to access the png files directly? If they are displayed in an HTML page, they work fine.

This SO article may also help




--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

john

unread,
May 14, 2013, 9:08:52 AM5/14/13
to google-a...@googlegroups.com
Well, if the .png file contained alot of detail or was a photograph, for example, I might use the browser function "Open image in a new tab" to look at it in more detail. But if I do that with png images served by appengine, the resulting behavior -- an image download in Windows, or a quicktime logo in OS X -- makes my app look more like a high school project with a bug in it than a professional site. Rather than live with this strange behavior, I'll apply a workaround.

Side note: I see that this issue was first reported to the Chrome team 3+ years ago (issue 25293), so it's obviously not a priority at Google.

Vinny P

unread,
May 14, 2013, 12:40:25 PM5/14/13
to google-a...@googlegroups.com
I don't know what your planned workaround is, but have you considered the Blobstore for saving your images?

From your comment, it looks like you're using detailed/photo-quality images, and uploading them as part of your application deployment. By moving images to the Blobstore you don't need to redeploy your app every time you need to add an image. Also the Blobstore allows you to specify the mime type of an image, so you can retain the "open image in a new tab" functionality.


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/
Reply all
Reply to author
Forward
0 new messages