Crop Override Contribution

22 views
Skip to first unread message

Paul Bailey

unread,
Nov 14, 2011, 4:11:30 PM11/14/11
to armstr...@googlegroups.com
Another thing I think we do very well in the CultureMap code is cropping.  Since we are very image heavy, we have many crops.  We have a lot of party photos with women wearing gowns and such.  When we first launched, the automatic crops a lot of times would center on their chests to put it nicely :-).  So while most of time the automatic crops of Sorl were great, we needed a way to override them.  So we came up with crop overrides.

Each image has three image overrides:
  1. Square Crop
  2. Landscape Crop
  3. Portrait Crop
Lets take the square crop for example.  If no crop image is uploaded then a square crop is generated from the original.  If a square crop image does exist then that is used instead to generate the crop.  This feature gives you the ability have automatic crops most of the time, but also easily change the crop if something embarrassing occurs.

Everything is done through additional image fields on the image model and a template tag like such:
{% crop_override image "square" im %}
<img src="{{ im.url }}" title="" alt=""/>
{% endcrop_override %}

Additionally we hooked up picnik.com so that a crop could be created from the Admin CMS with a few clicks.

Our editorial team loves this feature, so if you would like me to contribute it to Armstrong just let me know.

Travis Swicegood

unread,
Nov 14, 2011, 4:22:30 PM11/14/11
to armstr...@googlegroups.com
So each crop style is an additional image that someone can upload?  Definitely makes sense to add something like that so I'm +1.  Let's put that down for the second PR and we'll target v1.2 with that feature.

Picnik also sounds interesting, though I'm not sure if it belongs as part of the base armstrong.apps.images.  At least, I wouldn't want someone to *have* to sign up for a third-party service just to use it.  Seems like it would make an excellent add-on though, if we can make it so it's optional.

-T

-- 
Travis Swicegood | @tswicegood (most everywhere) | Senior Open Source Engineer @ Texas Tribune / Armstrong | 512.693.7051

Paul Bailey

unread,
Nov 14, 2011, 4:32:00 PM11/14/11
to armstr...@googlegroups.com
Here is the simplefied CultureMap model:
class Photo(models.Model):
    src                 = models.ImageField(upload_to=photofile_path, verbose_name='File Upload', )
    landscape_over      = models.ImageField(upload_to=photofile_path, verbose_name='Landscape Crop Override', blank=True, null=True)
    portrait_over       = models.ImageField(upload_to=photofile_path, verbose_name='Portrait Crop Override', blank=True, null=True)
    square_over         = models.ImageField(upload_to=photofile_path, verbose_name='Square Crop Override', blank=True, null=True)

So you can upload an image for each field.  In our case you can also click on the a picnik link which basically sends an image back to CMS to upload in the appropriate slot.

There is definitely no problem to make Picnik optional.  I think you could also make it customizable.  Most of the online photo editors have a similar API for getting images in and out.  Off the top of my head, I know you could make it generic enough to support Picnik, Pixlr, and Aviary by allowing a settings change.

Paul Bailey

unread,
Dec 20, 2011, 3:23:44 PM12/20/11
to armstr...@googlegroups.com
Saw the Image Set contribution got merged :-)

What's the timing on this contribution?  Is this still something you want? And if so when is 1.2 going to drop?

If all is good, I'll work on it soon.

Travis Swicegood

unread,
Dec 20, 2011, 3:33:47 PM12/20/11
to armstr...@googlegroups.com
Hey Paul;

I'm going to roll a 1.2 release for armstrong.apps.images with this change this afternoon.  Just had to get the tests passing on the CI server.

We rarely bundle a bunch of features together into point releases.  Instead, as soon as something's ready it gets shipped as a point release.  As soon as you've got the crop override ready, I'll merge it in and roll another release.

The plan is for 11.12 of Armstrong to hit sometime next week toward the end of the week.  That'll have the latest version of everything frozen for three months.  People can still upgrade individual packages in the meantime, but if you want crop overrides in the main Armstrong package by default before the end of March, your best bet is to have it in this week.

-T

-- 
Travis Swicegood | @tswicegood (most everywhere) | Senior Open Source Engineer @ Texas Tribune / Armstrong | 512.693.7051

Reply all
Reply to author
Forward
0 new messages