how can i return a image in mod python ?

A

Abandoned

Hi..
I want to show the pictures with mod python directly.

def showimage(req):
some process...
open /var/www/a.jpg and print

for example if i open:
domain.com/a.py/showimage
It must show me image directly (no redirect or html)

How can i do it ?
I'm sorry for my bad english.
Kind Regards....
 
A

Arnaud Delobelle

Hi..
I want to show the pictures with mod python directly.

def showimage(req):
some process...
open /var/www/a.jpg and print

for example if i open:
domain.com/a.py/showimage
It must show me image directly (no redirect or html)

How can i do it ?
I'm sorry for my bad english.
Kind Regards....

How about:

def showimage(req):
req.content_type="image/jpeg" # Change to you image type
req.sendfile("/path/to/image.jpg")
return apache.OK

HTH

BTW mod_python has its own list :)
 
A

Abandoned

How about:

def showimage(req):
req.content_type="image/jpeg" # Change to youimagetype
req.sendfile("/path/to/image.jpg")
returnapache.OK

HTH

BTW mod_python has its own list :)

Thank you but i have a another problem.

def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)

give me some error.
How can i return this image witdhout save ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top