Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#425 closed enhancement (wontfix)

django.utils.images should have a thumbnail function

Reported by: espen@… Owned by: adrian
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: UI/UX:

Description

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

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by adrian

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 Changed 9 years ago by Esaj

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 Changed 9 years ago by hugo <gb@…>

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 Changed 9 years ago by hugo <gb@…>

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 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.