jonasundderwolf / django-image-cropping

Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.
Other
553 stars 130 forks source link

get_thumbnail always returns the same cropping #99

Closed thundersystems closed 8 years ago

thundersystems commented 8 years ago

Hi, I've a problem with _getthumbnail method. The scenario is as follows:

models.py:

class MyModel(models.Model):
    header_banner_image = models.ImageField(
        blank=True, null=True,
        upload_to=get_upload_to,
        verbose_name=_('header banner image'),
    )
    # size is "width x height"
    header_banner_image_cropping = ImageRatioField('header_banner_image', '728x90')

    def get_header_banner_image_cropped(self):
        return get_thumbnailer(
            self.header_banner_image
        ).get_thumbnail({
            'size': (728, 90),
            'box': self.header_banner_image_cropped,
            'crop': True,
            'detail': True,
        }).url

my script:

iet = MyModels.objects.get(pk=4)
iet.get_header_banner_image_cropped()

Even if I change the cropping box in the admin, the _get_header_banner_imagecropped function it always returns the same cropping.

anrie commented 8 years ago

Looks like a typo: 'box': self.header_banner_image_cropped, should probably be 'box': self.header_banner_image_cropping,