Comments (7)
Paul said: (31 months ago)
does the smart crop work as a field option as well? eg:
ImageWithThumbnailsField(
upload_to = 'uploads/blog_img',
thumbnail = {'size': (89, 89), 'options': ['crop="smart"']},
the docs aren't clear.
p.s. go kiwi!
Chris said: (31 months ago)
Hi Paul,
They work as a field option - the whole dictionary is the options, so each option should just be a key: {'size': (89, 89), 'crop': 'smart'}
Paul said: (31 months ago)
I tried:
mainimg = ImageWithThumbnailsField(
upload_to = 'uploads/blog_img',
thumbnail = {'size': (180, 102), 'crop': 'smart'},
but now I get:
Exception Value:
Invalid attr 'size' found in 'thumbnail' arg
bit weird. no error if I take the 'crop':'smart' out altogether, but I'd like to use it.
Paul said: (31 months ago)
in the docs they do:
extra_thumbnails={
'icon': {'size': (16, 16), 'options': ['crop', 'upscale']},
'large': {'size': (200, 400)},
},
this works for me:
mainimg = ImageWithThumbnailsField(
upload_to = 'uploads/blog_img',
thumbnail = {'size': (180, 102), 'options': ['crop']},
but it's not smart cropping then of course
Chris said: (31 months ago)
Hang on, I think that was wrong advice I gave before. Try: {'size': (89, 89), 'options': {'crop': 'smart'}}
Paul said: (31 months ago)
cheers, works!
tezro said: (25 months ago)
Damn, 'options': {'crop': 'smart'} — totally great! Thanks.