thanks, that works great.
--~--~-~--~~~---~--~~
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
I'm no expert either, but this seems to work for me:
fp = StringIO()
myImage.save(fp, 'jpeg') # or whatever format
self.save_thumbnail_file(myName, fp.getvalue())
Nice thread. I was just fixin' to get to this for my demo app.
Thanks!
doug.
--~--~-~--~~~---~--~---
kwe wrote:
> I guess this means "if the PIL Image class can be used directly as
> input to the save_FIELD_file() call." - it can't ?
>
> sorry new to python and just want to check I'm reading the error
> correctly. Any ideas on how to change the type?
Again, I'm not somewhere I can confirm thi
Request Method: POST
Request URL:http://localhost:8000/admin/photos/photo/add/
Exception Type: TypeError
Exception Value:argument 1 must be string or read-only buffer, not
instance
Exception Location:
/usr/local/lib/python2.4/site-packages/django/db/models/base.
It might be worth you taking a look at the work done on Thumbnails in
DjangoUtils:
http://djangoutils.python-hosting.com/wiki/Thumbnails
Although not a solid chunk of code (there are a few issues with
namespaces, and it uses some Python 2.4 specific stuff), but with a
bit of hacking I got automa
Sasha wrote:
> def save(self):
> super(Picture, self).save()
> if self.image and not self.thumbnail:
> import Image
> myImage = Image.open(self.get_image_filename())
> myImage.thumbnail((150,150))
hey damian,
thanks for replying. i'd like to save the thumbnail into a separate
field. i just found the save_fieldname_file() method using the shell.
so my model looks like this:
class Picture(models.Model):
image = models.ImageField(upload_to="uploads", blank=True)
thumbnail = m
Sasha wrote:
> Hello,
>
> I'd like to create a thumbnail for an image after it has been uploaded.
> I have seen two possible approaches descibed here - subclassing
> ImageField and overriding the save() method of the model. Although the
> former seems more elegant, the latter seems like less work
Hello,
I'd like to create a thumbnail for an image after it has been uploaded.
I have seen two possible approaches descibed here - subclassing
ImageField and overriding the save() method of the model. Although the
former seems more elegant, the latter seems like less work and I'm
inclined to try
9 matches
Mail list logo