Hello,
I have been struggling for a couple hours now with serving jpg's with a python cgi site. For some reason the images always come out distorted.
Here is my code:
print('Content-type: image/jpg\n')
path = 'C:\\Users\\Admin\\Documents\\image.jpg'
print file(path, 'rb').read()
This post describes a nearly identical problem, however I am not using WSGI. I am using windows and apache and have played around with \r\n\r\n
as well as print 'Content-type: image/jpg\r\n\r\n',
. Similarly I have tried print file(path, 'rb').read(),
thinking that a new line might be distorting the image somehow.
Any more troubleshooting ideas?
Thanks, Josh
ps. The site must remain a cgi site.
[edit] changed to print('Content-type: image/jpeg\n')
[edit] example image: