Thursday, April 4, 2013

[django-users] How to dynamically set crop processor parameters in django-imagekit ?

Hi,

I am using django-imagekit to crop images.
I have this model:

from imagekit.models import ImageSpecField
from imagekit.processors import Crop

class Image(models.Model):
    x1 = models.IntegerField(blank=True, default=0)
    y1 = models.IntegerField(blank=True, default=0)
    height = models.IntegerField(blank=True, default=0)
    width = models.IntegerField(blank=True, default=0)
    image_file = models.ImageField(upload_to='images/')

    cropped_image = ImageSpecField(
        [Crop(width=171, height=82, anchor=None, x=-224, y=-283)],
        image_field='image_file',
        format='JPEG', options={'quality': 90})

How can I use the object's attributes x1, y1, width and height as parameters to Crop processor ?

Regards,

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate