1👍
✅
you can create a custom filter
that accepts the image url and specific width and return the URL with the width plugged in.
def format_img_src(img_ur, size):
"""Returns an image of specific size"""
# do your formatting here
0👍
class my_model_name(models.Model):
......
image = models.ImageField(default='default.jpg', upload_to = '')
def save(self, *args, **kwargs):
super(my_model_name, self).save(*args, **kwargs)
img = Image.open(self.image.path)
if img.height>300 or img.width > 300:
img.thumbnail( (300,300) )
img.save(self.image.path)
If you use this save
mathod than your all img save 300*300.you can chane your size .
- [Answered ]-Python/Django run development server
- [Answered ]-How do I reset template loader cache in Django 1.9?
- [Answered ]-How do I get credentials of python-social-auth for google drive sdk?
Source:stackexchange.com