Processors in view

44 views
Skip to first unread message

Graeme

unread,
Dec 20, 2012, 5:04:54 AM12/20/12
to django-...@googlegroups.com
I want to resize images according to user preferences (the user who uploaded the image, not looking at it). Is it possible to do this and still have Imagekit cache the image?

matthewwithanm

unread,
Dec 20, 2012, 2:30:24 PM12/20/12
to django-...@googlegroups.com
Not really. There are internal (undocumented) functions that you might be able to use to accomplish this, but basically, the answer is no.

However, this has been requested a few times and was one of the goals of IK3. IK3 is very very close to an alpha release but I've been busy lately and haven't been able to do the last 2% of work. I hope to knock it out after the holidays.

With IK3, it looks something like this:

    from imagekit import ImageSpec
    from imagekit.files import GeneratedImageCacheFile
    
    class MySpec(ImageSpec):
        processors = [...]
        format = 'JPEG'
        # etc

    spec = MySpec(source=some_file)
    new_file = GeneratedImageCacheFile(spec)
    new_file.validate()

I know this isn't the answer you were hoping for, but I hope it helps.

matthewwithanm

unread,
Feb 10, 2013, 4:16:55 PM2/10/13
to django-...@googlegroups.com
Hopefully you've noticed that we've pushed the 3.0 alpha to the development branch on GitHub! We even wrote a section in the docs that addresses just this use-case.

Graeme

unread,
Feb 14, 2013, 8:56:35 AM2/14/13
to django-...@googlegroups.com
Thanks, I did notice, and Imagekit 3 looks really great. The template tags are very nice to have as well. 

matthewwithanm

unread,
Feb 14, 2013, 9:46:52 AM2/14/13
to django-...@googlegroups.com
Thanks! Hopefully you'll have a chance to try it out soon!
Reply all
Reply to author
Forward
0 new messages