matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

Unable to Soft Crop Uploaded Image and upload to respective folder #507

Open chandra10207 opened 3 years ago

chandra10207 commented 3 years ago

I have the following model on my App

def image_path(self, filename):
    return 'app_name/images/{}/{}'.format(slugify(self.name), filename)

class Color(models.Model):
    name = CICharField(max_length=22, unique=True)
    image = models.ImageField("Image", upload_to=image_path, blank=True)

Once the image is uploaded I want to create 3 images size: small (100 by 100), medium (300 by 300) and large (800 by 800) with the soft image crop. Then I want to manage the URL Structure for my upload.

For Eg.

Original Image URL from "Image" field = 'app_name/images/image_1.jpg' Then Cropped Image from imagekit produce following images.

small = 'app_name/images/small/image_1.jpg' medium = 'app_name/images/medium/image_1.jpg' large = 'app_name/images/large/image_1.jpg'

I didn't found any options for this on the documentation page. Can anyone tell me, Is this possible with Imagekit.

Thanks.