Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#425 closed enhancement (wontfix)

django.utils.images should have a thumbnail function

Reported by: espen@… Owned by: Adrian Holovaty
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

i just taught that django.utils.images should have a function that could create a thumbnail.

Change History (5)

comment:1 by Adrian Holovaty, 19 years ago

Can somebody write a patch? Just add a function get_thumbnail (which would return the raw bytes of the thumbnail, right?) in django/utils/images.py.

comment:2 by Esaj, 19 years ago

It would be nice if thumbnails were created when the image file is initially uploaded. Is there an elegant way to do this? Creating several different sized thumbnails per original image would be useful too.

comment:3 by hugo <gb@…>, 19 years ago

Feel free to steal the code from the image helper in my "stuff" project. There are two functions interesting in this context: cropImage will crop out the largest part of an image that will fit in the bounding box while scaleImage will scale the image so that it will fit into the bounding box while keeping it's aspect ratio. Both functions take the bounding box and a PIL image as input and return a PIL image as output.

comment:4 by hugo <gb@…>, 19 years ago

Oh yes, sorry: to get the image as a stream of bytes, just do a result.save(..) on a StringIO object. To read your original file just do a PIL.Image.open(..) on your file.

comment:5 by Adrian Holovaty, 19 years ago

Resolution: wontfix
Status: newclosed

Marking this as a wontfix, cause there are many more other things to do and this is a bit out of the scope of Django.

Note: See TracTickets for help on using tickets.
Back to Top