content-type: image/png のヘッダーを返し、画像を返すだけの python スクリプトを cgi-bin に設定しようとしています。画像を開いて戻そうとしましたが、うまくいきませprint f.read()ん。
編集:私が使用しようとしているコードは次のとおりです:
print "Content-type: image/png\n\n"
with open("/home/user/tmp/image.png", "r") as f:
print f.read()
これは、ubuntu サーバー 10.04 で apache を使用しています。ページをクロムでロードすると壊れた画像が表示され、ページをFirefoxでロードすると取得されますThe image http://localhost/cgi-bin/test.py" cannot be displayed, because it contains errors.