On Sat, Feb 2, 2013, nYmo <symf...@gregorpanek.de> wrote: >I'm new to django and also python but have already some programming >experience. I'm currently creating my first application in django and get >stucked because I'm looking for the best way to resize uploaded images. >I'm already so far that I can upload/delete/update my images and show them >in my view. Now I want to resize the images for my view and thought about >the best way? > >First question: Is it possible to resize the images on the fly? For example >I uploaded an image in 1920x1080px and now want to transform it to 400x200 >or something similar when the view is being loaded? Is this a convenient >way in django or not?
It's certainly possible. I recommend <http://easy-thumbnails.readthedocs.org>, which is robust and well-supported. Once it has resized an image for you, it will serve up the resized file, until something changes (such as the dimensions you require), in which case it will create a new copy at the size you want. It's fast enough at resizing images on the fly that I am often not sure whether it is returning an image it has previously resized for that page, or is doing it right now. I use it with Django Filer, which manages uploaded images. <https://github.com/stefanfoulis/django-filer>. Amongts other things Django FIler allows you to mark the part of the image that is important, so that if the image is cropped, the important part will not be cut out. I also use it as part of some other Django software that inspects its own templates as they are being rendered, and is able to calculate the corrct size of an image wherever it's being placed. Even with all this going on, it seems perfectly fast enough to use on the fly. Daniele -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.