May be somebody faced with such issue and found good solution. I need rotate image in template before upload and save the record. I can rotate image view in template using JavaScript but it doesn't give any results, because image saves in original rotation. I saw several sites with such kind of feature and it's really useful.
Asked
Active
Viewed 611 times
1
-
you mean rotate by specific degree or by 90 degrees? – Anatoly Strashkevich Oct 24 '16 at 10:39
1 Answers
3
You cannot get rotated image from Django templates. I assume you are working on a web app, where user uploads an image, rotates it and then saves it to later use. This can be done in the following way.
There is a lib for working with images in Python called PIL. You can use it in your view, which saves your image to the db. When a user plays with an image, use javascript for rotations on the front end. But when saving, let javascript send angles to the view and then make according changes to the uploaded image and then save to the db.

Community
- 1
- 1

Adilet Maratov
- 1,312
- 2
- 14
- 24
-
we used [croppic](http://www.croppic.net/) in the frontend - it is capable of sending cropping information over to the a django view which finally does the transformation with the fork pillow of the suggested PIL. – dahrens Oct 24 '16 at 10:49