How can I resize image when I upload with ImageField
by protecting aspect ratio of image.
Example: (Width x Height) from 1100x600 to 550x300
And, is it possible with [ImageKit]
? https://github.com/matthewwithanm/django-imagekit
How can I resize image when I upload with ImageField
by protecting aspect ratio of image.
Example: (Width x Height) from 1100x600 to 550x300
And, is it possible with [ImageKit]
? https://github.com/matthewwithanm/django-imagekit
You can use easy-thumbnails package for optimizing images. Just follow these steps:
First install easy-thumbnails package using command:
pip install easy-thumbnails
Go to settings.py file and add easy_thumbnails to the INSTALLED_APPS setting as like:
INSTALLED_APPS = [
# ...
'easy_thumbnails',
]
Run this command to apply changes in database
python manage.py migrate
Now go to your template and replace the line(as I supposed):
<img src="{{ image.image.url }}">
To the following lines:
{% load thumbnail %}
<img src="{% thumbnail image.image 550x300 %}"