Hello all,

I am trying to save base64 string string image to database but I am not 
able to store. I am beginner for python django language.

I am following these steps:--

from base64 import b64decode
from django.core.files.base import ContentFile
from time import time
import cStringIO
import base64


pic = cStringIO.StringIO()
        image_string = 
cStringIO.StringIO(base64.b64decode(request.POST['photo']))
        image = Image.open(image_string)
        image.save(pic, image.format, quality = 100)
        pic.seek(0)
        return HttpResponse(pic, content_type='image/jpeg')

but I have error 

TypeError: Incorrect padding

Please help me for store the base64 image string in the database.


Thanks & Regards,

Yogesh Waghnare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54b12c7e-e9b0-4a47-85ce-988c897bbd11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to