Hi Folks,
I'm using AWS S3 Bucket to store media folder(images) but I want to resize each every image in 300*300. So, I'm overriding the save method inside django model class. But I'm getting one error caled:
NotImplementedError: This backend doesn't support absolute paths.
My django models look like:
class Profile(models.Model):
user = models.OneToOneField(
AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="profile"
)
profile_pic = models.ImageField(default = 'profile.jpg',upload_to = user_directory_path, null = True)
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
img = Image.open(self.profile_pic.path)
if img.height > 300 or img.width > 300:
output_size = (300, 300)
img.thumbnail(output_size)
img.save(self.image.path)
I don't know how to solve this issue.
Thank you in advance
Regards,
soumen