0

I wanted to know if it possible to save an ImageField from a Facebook URL

this is my class:

class Images(models.Model):

    name        = models.CharField(max_length=250)
    type        = models.CharField(max_length=100)
    img_200     = models.ImageField(upload_to='media/200/')

    def __unicode__(self):
        return self.name

i tried with this but i get an error:

    urllib.urlretrieve(event.get('pic_big'), os.path.join(file_save_dir, filename))
    photo.img_200 = os.path.join(file_save_dir, filename)
pedrotorres
  • 1,222
  • 2
  • 13
  • 26
  • 2
    What is the error? Can you add the full traceback? – Nicolas Cortot Apr 23 '13 at 23:03
  • 1
    i gave an answer here may be it will be helpful for you http://stackoverflow.com/questions/16174022/imagefield-in-django/16177921#16177921 – boltsfrombluesky Apr 24 '13 at 03:04
  • @boltsfrombluesky I am using your example and it kinda works. But I have another problem. I am downloading images from facebook. And it keeps the facebook url. which doesn't work cuz of facebooks outside url protection. – pedrotorres Apr 25 '13 at 16:18
  • sorry i was using the wrong address. I got it to work now. Thanks a lot! :) – pedrotorres Apr 25 '13 at 16:56

0 Answers0