SmileyChris/easy-thumbnails — Issue #104: Creating a thumbnail from a URL
Author: alex-marandon
Created: 2011-12-22 18:25:28+00:00
State: open

Hi, I'm trying to create a thumbnail from an image located on the web (facebook profile picture).

After reading the doc at http://packages.python.org/easy-thumbnails/usage.html#non-django-file-objects , I thought this would work:

profile = user.get_profile()
photo = urllib2.urlopen(photo_url)
thumbnailer = get_thumbnailer(photo, relative_name="foo.jpg")
profile.mugshot = thumbnailer.get_thumbnail()
profile.save()

But I'm getting this error:

Unknown object type, expected a Thumbnailer, FieldFile, File or Storage instance.

Looking at the code https://github.com/SmileyChris/easy-thumbnails/blob/master/easy_thumbnails/files.py#L62 it seems that it checks for specific instances and doesn't actually just expect a file-like object.

Am I missing something or do I have to manage somehow to give it a Django object?

Thanks!