Nearly there.... with this code...

from PIL import Image,ImageFile
def get_image(src):
        import urllib

        fp = urllib.urlopen(src, "rb")
        p = ImageFile.Parser()

        while 1:
                s = fp.read(1024)
                print ".",
                if not s:
                        break
                p.feed(s)

        im = p.close()
        im.thumbnail((128,128),Image.ANTIALIAS)
        im.save("/Users/tomsmith/Desktop/" + src)

for product in Product.objects.all( ).order_by('-id')[:10]:
        print product.id
        print product.img
        print product.url
        get_image(product.img)

... but I think I get a "redirect" header if I use urllib2... and  
urllib seems to just wait and wait....

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to