Commit graph

1027 commits

Author SHA1 Message Date
Matthew Tretter
bd7eb7284b BoundImageSpec is now ImageSpecFile
In preparation for unifying the ImageSpecFile and
ProcessedImageFieldFile interfaces.
2011-09-22 09:20:37 -04:00
Matthew Tretter
5718c304cf ProcessedImageField replaces preprocessor_spec 2011-09-22 00:24:13 -04:00
Matthew Tretter
98a5ca32b4 Fix bug when imgfield doesn't exist. 2011-09-21 23:10:06 -04:00
Matthew Tretter
a60dfba31d IKOptions no longer exists. 2011-09-21 21:15:16 -04:00
Matthew Tretter
788257b819 property_name is now attname
That's what Django calls it; that's what we'll call it.
2011-09-21 21:15:16 -04:00
Matthew Tretter
fb53981ec8 No need to extend ImageModel.
In fact, ImageModel doesn't exist anymore. Most of IKOptions have also been
removed.
2011-09-21 21:15:09 -04:00
Matthew Tretter
7167016237 Removed specs list from opts. 2011-09-21 20:21:48 -04:00
Matthew Tretter
305d20569c Moved get_bound_specs to utils. 2011-09-21 20:17:23 -04:00
Matthew Tretter
4e23254e73 Crop processor accepts anchor argument. 2011-09-21 19:02:18 -04:00
Matthew Tretter
e4c4fe02b3 Separated Crop.process() and Fit.process()
They didn't have enough in common to warrant them being branches of the
same method.
2011-09-21 18:24:02 -04:00
Matthew Tretter
b5616d2f75 Move ImageSpec to fields module. 2011-09-21 11:37:29 -04:00
Eric Eldredge
fe2fb844af Changed the way post_save and post_delete signals are being handled.
One handler is created per model instead of per bound image spec.
This cuts down on the number of handlers created, and also offloads the
policing of the handlers in memory to the signal framework. Since they are no
longer being created per spec, the handlers can be weakly referenced.
2011-09-21 10:44:05 -04:00
Eric Eldredge
b1c5432310 Implemented post_save and post_delete handlers for ImageSpecs.
Removed the save and clear_cache methods from ImageModel (along with helpers).
Now, whenever an ImageSpec is contributed to a model, handlers are created for
the post_save and post_delete signals. The post_save handler does the work of
running the ImageSpec processors and caching the resulting file, while the
post_delete handler does the work cleaning up the cached files.
2011-09-21 09:56:27 -04:00
Matthew Tretter
34e475885b Unbound fields are accessible from class. 2011-09-21 09:52:38 -04:00
Matthew Tretter
2770be23ea Naming & implementation of bound fields are more consistent.
Bound fields are now named as such (BoundBlah), extend their unbound
counterparts, and their constructors accept an unbound instance.
2011-09-21 09:39:06 -04:00
Matthew Tretter
a71b3ca337 Removed Format processor
The Format processor was really a special case and didn't do any
processing at all. Instead, ImageSpec just knew to look for it and
responded accordingly. Therefore, it's been replaced with a `format`
property on ImageSpec. This warranted a deeper look at how the format
and extension were being deduced (when not explicitly provided); the
results are documented in-code, though the goal was "no surprises."
2011-09-20 21:34:00 -04:00
Matthew Tretter
80c785f2e5 No need for this. 2011-09-20 21:03:34 -04:00
Matthew Tretter
544d5b874a Added AdminThumbnailView field.
You're no longer restricted to just one, special-case admin thumbnail. Make as
many as you want by adding AdminThumbnailView properties to your model and
including them in your admin class's `list_display` tuple. You can also provide
a custom template. Note that (because this change introduces templates to
imagekit), imagekit is now required in INSTALLED_APPS.

Ideally we could get this stuff out of the model, but we'll have to look into
whether that's possible without making things really complicated.
2011-09-20 19:37:04 -04:00
Matthew Tretter
501d3c7ad3 Now using contribute_to_class.
By creating the Descriptor using contribute_to_class (instead of in
ImageModelBase's __init__), we take the first step towards eliminating the need
to extend ImageModel at all.
2011-09-20 15:44:54 -04:00
Matthew Tretter
82348d4931 Changed how cache files are named.
Removed the cache_dir, cache_filename_fields and cache_filename_format
properties of IKOptions. While these were very powerful, I felt that it was
unnecessarily confusing to have two properties (cache_dir and
cache_filename_format) that determine the filename. The new cache_to property is
modeled after ImageField's upload_to and behaves almost identically (the only
exception being that a callable value receives different arguments). In
addition, I felt that the interpolation of model properties provided by
cache_filename_fields, though useful, would be better handled by a utility
function outside of this library.
2011-09-18 21:08:49 -04:00
Bryan Veloso
df93146049 Making versioning a little easier on myself. 2011-09-12 14:17:12 -07:00
unknown
e295c9c039 error fix: https://github.com/jdriscoll/django-imagekit/issues/25 2011-09-12 17:43:53 +08:00
Bryan Veloso
a3ed700117 Fixing some spelling. Fixes #29. Thanks Nai! 2011-09-12 02:23:48 -07:00
Matthew Tretter
8cfe485a5a Storage can be specified on a per-spec basis.
If not defined on the spec, IKOptions.default_storage will be used. If that's
not defined, it will fall back to the image field's storage.
2011-09-10 00:25:34 -04:00
Matthew Tretter
57a28091c5 Added default_image_field
This works kind of like Django's models' _default_manager. If your specs don't
specify an image_field, and your IKOptions don't specify a default_image_field,
the first ImageField your model defines will be used.
2011-09-10 00:25:27 -04:00
Matthew Tretter
4c78f2d24c _imgfield is now a property of ImageSpec
Moved _imgfield from ImageModel to ImageSpec. Theoretically, this will allow you
to have specs that use different image fields on the same model.
2011-09-10 00:24:37 -04:00
Matthew Tretter
5e00de5204 Admin thumbnails. 2011-09-10 00:23:47 -04:00
Bryan Veloso
f9b79aa67f Tests now pass and don't leave any directory cruft. Fixes #28.
Tests were failing because they assumed that the file was deleted upon
teardown. This isn't the case after Django 1.3, where this no longer
happens. This fix removes any orphaned files (and directories) that were
created via the testing process.
2011-09-09 17:57:18 -07:00
Bryan Veloso
49df1caf63 Adding a test runner script a la #daniellindsleyrocksdahouse. 2011-09-09 17:53:00 -07:00
Bryan Veloso
e251b8903b Creating a "core" test module. 2011-09-09 17:51:22 -07:00
Bryan Veloso
9af96b4098 Creating a dedicated tests directory.
Moves tests.py out of the main module. Still a work in progress.
2011-09-09 16:33:42 -07:00
Bryan Veloso
6082b2b782 Let's get these docs started. 2011-09-09 15:53:49 -07:00
Matthew Tretter
a1f11facbe Processors now use static properties. 2011-09-08 16:49:44 -04:00
Matthew Tretter
db4d704f71 Changed ImageSpec constructor so you can use static properties.
For example:

    class MyImageSpec(ImageSpec):
        quality = 100

    class Photo(ImageModel):
        display = MyImageSpec()
2011-09-08 16:48:53 -04:00
Matthew Tretter
0b0942921b Updated README to reflect the new API. 2011-09-08 15:52:03 -04:00
Matthew Tretter
def8dea23f Storage moved onto ImageSpec. 2011-09-08 10:28:54 -04:00
Matthew Tretter
e32ccb617d Resize split into Crop and Fit. 2011-09-08 10:28:54 -04:00
Matthew Tretter
cd3395b68f Processors are now instance-based. 2011-09-08 10:28:50 -04:00
Matthew Tretter
a9895f335a Using spec properties from ImageModel. 2011-09-08 10:00:22 -04:00
Bryan Veloso
7dc8b9159e Merge branch 'release/0.4.0' into develop
* release/0.4.0:
  Think it's time to bump to 0.4.0.
2011-09-07 16:00:37 -07:00
Bryan Veloso
5a56327ba6 Merge branch 'release/0.4.0'
* release/0.4.0:
  Think it's time to bump to 0.4.0.
  Adding Markus and Matt to AUTHORS.
  Added ability to specify specs in IKOptions directly.
  Improve fault tolerance of Accessor._delete()
  fix issue #12
  proper python comments in readme
  Adding Josh to the contributors list.
  Being a good PyPI citizen.
  allowing any fields on the object to be specified for use in naming of generated images; default to allowing pk
  Added the pk of the object into the dictionary of values passed to the string formatting for cache_filename.
  Added the quality property in the readme's ImageSpec classes just to show it is possible to change it at will.
  Fixes: CMYK files from Photoshop fails to load with exception -2
2011-09-07 16:00:09 -07:00
Bryan Veloso
7cb59c7351 Think it's time to bump to 0.4.0. 2011-09-07 15:52:14 -07:00
Bryan Veloso
11e9064a19 Adding Markus and Matt to AUTHORS. 2011-09-07 15:45:06 -07:00
Bryan Veloso
5e447180dc Merge pull request #27 from matthewwithanm/develop
Added ability to specify specs in IKOptions directly.
2011-09-07 15:43:24 -07:00
Matthew Tretter
2387cc4be2 Added ability to specify specs in IKOptions directly. 2011-09-02 23:35:58 -04:00
Bryan Veloso
14ef6633b9 Merge pull request #24 from mkai/develop
Minor improvement to fault tolerance of Accessor._delete()
2011-08-26 11:52:49 -07:00
Markus Kaiserswerth
3e3302c7f7 Improve fault tolerance of Accessor._delete()
Handle/ ignored NotImplementedError and IOError which might get thrown
by the storage backend on delete.
2011-08-26 16:42:14 +02:00
BaBaBags
db95e63a63 Added support for preserving transparency when converting from color to greyscale 2011-08-23 10:20:37 -04:00
Bryan Veloso
4a1d1d9715 Merge pull request #22 from Bers/patch-1
fix issue #12
2011-07-10 18:18:55 -07:00
Bers
aa348d76f6 fix issue #12 2011-07-04 04:09:31 -07:00