Login

Snippets by clawlor

Snippet List

create_template_postgis-ubuntu_lucid

The template creation script referenced [here] (http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ubuntudebian) doesn't work on Ubuntu Lucid, where the default PostgreSQL version is now 8.4 and some things have been moved around. I've edited the script to work on Ubuntu Lucid.

  • postgis
  • ubuntu
Read More

Image model with thumbnail

A relatively simple Photo model which generates its own thumbnail when saved. A default size is specified as `thumb_size` in the `save()` arguments. Other thumbnailing strategies don't save the thumbnail dimensions, and since the actual dimensions of the thumbnail created by PIL's `thumbnail` method are somewhat non-deterministic, it is difficult to create an `img` tag with proper height and width attributes. This approach makes that task simple. This approach works well if only one thumbnail size is required. It could easily be adapted to support two or three thumbnail sizes, but adding more sizes would quickly get unwieldy. This was adapted from http://biohackers.net/wiki/Django1.0/Thumbnail

  • image
  • thumbnails
  • thumbs
Read More

clawlor has posted 2 snippets.