CroppingImageField

by Ben Mason last modified Feb 16, 2011 02:12 AM
Contributors: Harald Friessnegger

An Archetypes based field to allow you to specify exact dimensions for resized images.

Project Description

We needed a field that ensured all images on a site were of the same dimensions.

Just add this field to your archetype and you can specify dimensions, similar to that of the ImageField, but this field will scale images and crop the overhang, hence the name!

Requirements

PIL

Usage

 
Install as usual in your Products folder, or use the egg available on cheeseshop

Add to your archetype:

from croppingimage.field import CropppingImageField

Then add it to your schema:

CroppingImageField('image',
               long_edge_size = 600,
               short_edge_size = 450,
               sizes= {'large'  : (600, 450),
                       'medium' : (300, 225),
                       'thumb'  : (125,  94),
                      },
               widget=ImageWidget())

When you upload a landscape image, it will be resized to 600x450. A portrait image will be resized to 450x600. The other image sizes are resized accordingly.

If you want portrait images to be cropped to landscape format or landscape images to be cropped to portrait ones use the force_format='landscape' property.

See the documentation section for some croppingimagefield usage-examples.
 

A CroppingImageField example is provided in the croppingimage.py

 

Current Release

No stable release available yet.

All Releases

Version Released Description Compatibility Licenses Status
0.2 Jul 23, 2008 CroppingImageField also supports forced_formats, and is available as egg in the cheeseshop More about this release…
Plone 2.5
Plone 3
GPL release-candidate
0.1 Initial release More about this release…
Plone 2.1.2
Plone 2.1.1
Plone 2.1
GPL beta