jonasundderwolf / django-image-cropping

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

get_thumbnail does not respect the box #89

Closed romulocollopy closed 8 years ago

romulocollopy commented 8 years ago

Python 3.4.0 Django==1.9.2 Pillow==2.9.0 django-image-cropping==1.0.3 easy-thumbnails==2.2

I'm using the python method mentioned in the documentation, but I've tried others too. The image is being cropped always in the vertica center, no matter wich position the ImageRatioField sets.

In the generated filename I cansee the right box detais.

I have tryied to fund something in easy_thumbnails code and docs, but I coun't figure out eighter. I have the same method working fine in a Django 1.6 / python 2.7 project

# models.py
DETAIL_CROPPING_SIZE = 1860, 550
class DetailCroppedImage(models.Model):

    featured_image = models.ImageField(_('Featured Image'),
                                       upload_to='images/entries')

    detail_view_cropping = ImageRatioField(
        'featured_image', '{}x{}'.format(*DETAIL_CROPPING_SIZE)
    )

    def get_featured_image(self):
        return get_thumbnailer(self.featured_image).get_thumbnail({
            'size': DETAIL_CROPPING_SIZE,
            'box': self.detail_view_cropping,
            'crop': True,
            'detail': True,
        }).url
<!-- template -->

<img src="{{ detail_image.get_featured_image}}" />
romulocollopy commented 8 years ago

it was an import error