Hey dudes
This code worked fine
The one you gave me worked as well but when I wanteed to store it in the database it says that the packet was too large
Whit this code it doesn't complain but now I don't know how to retrieve the image
This is what I'm doing:
import MySQLdb
import Image
import Image
from StringIO import StringIO
im = Image.open("auto.jpg")
outFile = StringIO()
im.save(outFile, "JPEG")
db=MySQLdb.connect(connection string)
cursor=db.cursor()
cursor.execute("insert into image values('',%s)",outfile)
ima = Image.open(outFile) >######
Then I retrieve it like this:
db=MySQLdb.connect(connection string)
cursor=db.cursor()
cursor.execute("select * from image")
res=cursor.fetchall()
Now I have the binary string in res[1] but when I try to open it it gives me an error (I'm sorry I'm not in the machine that has the database and I forgot to copy the error :/)
the fields in MySQL version 4 are Cod_Imagen int(4) auto_increment primary key, data longblob)
Thanks in advanced
Alberto
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor