예제 #1
0
 def clean(self, *args, **kwargs):
     super().save(*args, **kwargs)
     img = Image()
     self.small_image_path = img.compress_image_tinify(image=self.image)
     super().save(*args, **kwargs)
예제 #2
0
def compress_discount_image(sender, instance, **kwargs):
    img = Image()
    for image in instance.discount_images.all():
        image.small_image_path = img.compress_image_tinify(image=image.image)
        image.save()
예제 #3
0
def compress_plus_item_image(sender, instance, **kwargs):
    img = Image()
    instance.small_image_path = img.compress_image_tinify(image=instance.image)
    instance.save()