Akiと申します。
私は
http://tnakamura.hatenablog.com/entry/20101209/kay_blobstoreで全く同じコードを使ってみました。
結果としては以下の通りです。
1.Localhostでは何のブラウザーでも画像が正しく表示されます。
2.GAEサーバーにコードをアップロードしたら
IEブラウザーで画像は正しく表されます。
Chome, Safari, Firefoxで画像は正しく表されていません。
そこで
class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, blob_key):
blob_key = str(urllib.unquote(blob_key))
blob_info = blobstore.BlobInfo.get(blob_key)
return self.send_blob(blob_info)
を
class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, blob_key):
blob_key = str(urllib.unquote(blob_key))
blob_info = blobstore.BlobInfo.get(blob_key)
return self.send_blob(blob_info,
'image/jpg')
に変更してGAEにアップロードすればすべてのブラウザー上では正しく表示されます。
blobstore_handlers.pyでは
If BlobInfo is provided and no content_type specified, will set request content type to BlobInfo's content type.と書いてありますがcontent_typeを設定しないといけないでしょうか
class BlobstoreDownloadHandler(BaseHandler):
"""Base class for creating handlers that may send blobs to users."""
def send_blob(self, blob_key_or_info, content_type=None, save_as=None):
"""Send a blob-response based on a blob_key.
Sets the correct response header for serving a blob. If BlobInfo
is provided and no content_type specified, will set request content type
to BlobInfo's content type.
何か理由を教えていただければ幸い。
どうぞよろしくお願い申し上げます。