Commit graph

620 commits

Author SHA1 Message Date
Matthew Tretter
1fb1d83c56 Add Thumbnail processor 2012-12-06 23:22:02 -05:00
Matthew Tretter
8c80ba3b4f GeneratedImageCacheFile stores file manipulation attributes
Everything for dealing with files should be part of
GeneratedImageCacheFile--not the generator. The fact that
GeneratedImageCacheFile can get this information (storage, filename,
etc.) is a convenience so that the user only has to define one class
(the generator) to fully specify their functionality, but handling the
cache file is not part of the core responsibility of the generator.

This is also the reason for the renaming of `get_filename` and `storage`
to `cache_file_name` and `cache_file_storage`: the generator is just as
useful for those who want to generate persistent files. But the original
attribute names didn't indicate that they were used only for cache
files. The new ones do, and don't preclude the addition of other
versions that would be used by another `File` subclass for specifying
file names or storage classes.
2012-12-06 19:54:26 -05:00
Matthew Tretter
12307c97aa Use state--not constructor args--to recreate dynamic specs
Previously, we were relying on `__init__`'s arguments to recreate specs.
Now we do it the proper way, using the dict returned by `__getstate__`
(which may or may not include those arguments).
2012-12-05 23:51:30 -05:00
Matthew Tretter
042bdcefb6 Simplify dynamic spec definitions
Use a closure instead of an attribute to store the class attrs.
2012-12-05 23:38:10 -05:00
Matthew Tretter
c45876f95c Ignore some style errors 2012-12-05 23:16:34 -05:00
Matthew Tretter
2a6199b804 Simplify get_hash implementation 2012-12-05 23:16:07 -05:00
Matthew Tretter
0ec6067c8d Correct pickling/unpickling of dynamic specs
Previously, __reduce__ was returning a reduction of the class, not the
instance.
2012-12-05 21:10:36 -05:00
Matthew Tretter
7f11f44c67 Special case source_file for specs
It was already special. Why hide it? Closes #173
2012-12-05 21:10:31 -05:00
Matthew Tretter
afc5900db6 Support decorator syntax for register.spec 2012-12-05 21:09:10 -05:00
Matthew Tretter
956601b5d0 Revert register.spec argument order
Since we got rid of inner Config classes, we can put the order back and
support decorators.
2012-12-05 21:09:10 -05:00
Matthew Tretter
a07bc49a25 Remove inner Config classes 2012-12-05 21:09:10 -05:00
Matthew Tretter
4f7ce68904 Add documentation for generateimage 2012-12-03 21:11:52 -05:00
Matthew Tretter
4f81e14f58 Re-add html attribute handling 2012-12-03 21:06:15 -05:00
Matthew Tretter
848d7d7fa3 Add TODOs 2012-12-01 23:19:45 -05:00
Matthew Tretter
14d2193f8d Remove unused args 2012-12-01 22:23:25 -05:00
Matthew Tretter
236eea8459 Move filename generation to generator 2012-12-01 22:09:34 -05:00
Matthew Tretter
20c900df4a Remove unused imports 2012-12-01 21:52:23 -05:00
Matthew Tretter
7bc82d3624 Remove arguments from generate() method
Previously, we had two places where we were passing kwargs that affected
the image generation: the ImageSpec constructor and the generate method.
These were essentially partial applications. With this commit, there's
only one partial application (when the spec is instantiated), and the
generate method is called without arguments. Therefore, specs can now
be treated as generic generators whose constructors just happen to
accept a source_file.
2012-12-01 21:20:33 -05:00
Matthew Tretter
5ecb491e65 Remove unused import 2012-12-01 20:47:55 -05:00
Matthew Tretter
7ed404f096 Switch args back to old order 2012-12-01 20:45:34 -05:00
Matthew Tretter
1f06c9ac70 Remove ImageSpecCacheFile 2012-12-01 20:41:08 -05:00
Matthew Tretter
9188499965 Rework template tag for generators 2012-12-01 20:36:31 -05:00
Eric Eldredge
e0567e8fa7 Remove specs.SpecRegistry; add registry module
The registry module splits the work that specs.SpecRegistry
used to do into two classes: GeneratorRegistry and
SourceGroupRegistry. These two registries are wrapped in
Register and Unregister utilities for API convenience.
2012-12-01 17:16:09 -05:00
Matthew Tretter
d253fe281a Rename image_field argument; closes #158 2012-12-01 16:46:10 -05:00
Matthew Tretter
54baa44900 Require spec id for form fields
Closes #163
2012-12-01 15:56:37 -05:00
Matthew Tretter
4ead0b3002 Add note about nested config classes 2012-12-01 15:51:40 -05:00
Matthew Tretter
5b1c5f7b4e Rename source objects to source groups 2012-12-01 15:51:28 -05:00
Matthew Tretter
49a55d4763 Try adding __reduce__ 2012-12-01 14:11:04 -05:00
Matthew Tretter
5a414a3644 Rename spec_args to spec_attrs 2012-11-06 23:50:23 -05:00
Matthew Tretter
aaa823afd6 Add flake8 linting 2012-11-05 23:34:32 -05:00
Matthew Tretter
c752eea6a0 Fix bug with black mat_color 2012-11-05 22:23:29 -05:00
Matthew Tretter
f9e2ce8649 Add TODO 2012-11-03 00:27:03 -04:00
Matthew Tretter
5494ee7fc1 Clarify relationship between BaseImageSpec and ImageSpec 2012-11-03 00:08:47 -04:00
Matthew Tretter
e56d687bb0 Name can be set explicitly on GeneratedImageCacheFile 2012-11-02 22:17:25 -04:00
Matthew Tretter
64d95768f8 Extract GeneratedImageCacheFile
As mentioned in #167, we want to be forward thinking and allow for a
hypothetical spec supertype which has the same functionality as an image
spec but doesn't require a source file: a generator. To this end, I've
renamed `ImageSpec.apply()` to `ImageSpec.generate()` and extracted
a `GeneratedImageCacheFile` base class from `ImageSpecCacheFile`, which
supports the more general interface of a generator--namely, a
`generate()` method with arbitrary args and kwargs.
2012-11-02 00:33:33 -04:00
Matthew Tretter
56f8d1b8bc Create form field class; re: #163 2012-10-25 22:46:28 -04:00
Matthew Tretter
6377f89e85 IKContentFile must have name attr 2012-10-25 22:43:10 -04:00
Matthew Tretter
570e7bd640 Simplify SpecHost creation 2012-10-25 22:31:37 -04:00
Matthew Tretter
76b9ebbab4 Omit missing kwargs so as not to override defaults
The default image cache strategy was being overridden, which prevented
images from being generated.
2012-10-25 22:25:18 -04:00
Matthew Tretter
006ff54fa8 Clean up version meta. 2012-10-25 20:01:26 -04:00
Matthew Tretter
fb8c411f75 Create new cache warming command
Replaces ikcachevalidate and ikcacheinvalidate, and uses the "sources"
abstraction. Closes #165
2012-10-24 23:41:05 -04:00
Matthew Tretter
84f3b6475b Add files() generator. Re: #165 2012-10-24 23:41:05 -04:00
Matthew Tretter
adf143edc5 add_source -> add_sources; switch argument order 2012-10-24 22:30:10 -04:00
Matthew Tretter
bdec396180 Support inner Config class for id, sources
Closes #164
2012-10-24 22:23:53 -04:00
Matthew Tretter
8d3fcafcd9 Swap argument order for specs.register
This will allow us to put the id in the inner Meta class.
2012-10-24 22:14:45 -04:00
Matthew Tretter
d110b82347 Rename imagekit_tags to imagekit 2012-10-21 17:59:56 -04:00
Matthew Tretter
3dbb96ea40 Remove unused imports 2012-10-21 17:57:53 -04:00
Matthew Tretter
3e2c3803ff No need to call spec; the registry does that 2012-10-20 23:44:26 -04:00
Matthew Tretter
0c4d9738c6 Add TODO 2012-10-20 23:44:13 -04:00
Matthew Tretter
12493b3a0d Spec host must support kwarg "hints"
The registry's `get_spec()` was already supporting kwargs as a means to
provide information about the source to the spec constructor/factory
function, but the ``SpecHost`` class wasn't capable of accepting any.
This commit rectifies that. The main goal purpose of this is to allow a
bound field (the file attached by ``ImageSpecFileDescriptor``)--and the
attached model instance--to be taken into account during the spec
instance creation.

Related: #156
2012-10-20 23:29:07 -04:00
Matthew Tretter
aa91a70e46 Make specs know less about source files 2012-10-20 22:53:55 -04:00
Matthew Tretter
e796b4cc61 Create ImageSpec subclasses
Since the `ImageSpec` constructor will be accepting keyword arg hints,
it can no longer accept the properties.
2012-10-20 22:15:25 -04:00
Matthew Tretter
b0b466618f Separate two forms of tag; support additional html attrs
Closes #154
2012-10-17 23:41:34 -04:00
Matthew Tretter
770a8cebf4 Fix iteration error 2012-10-17 21:35:19 -04:00
Matthew Tretter
e300ce36a4 Use new registry name 2012-10-17 21:25:19 -04:00
Matthew Tretter
4f52e401d2 Handle null format 2012-10-17 21:24:57 -04:00
Matthew Tretter
98a6fff62d Add DEFAULT_FILE_STORAGE Setting; Closes #153 2012-10-17 21:09:04 -04:00
Matthew Tretter
ca1db05c4e Use named logger 2012-10-17 21:00:32 -04:00
Matthew Tretter
d8ce11e86e Log warning when filename doesn't match expected value 2012-10-17 01:11:05 -04:00
Matthew Tretter
806ebd75b6 Don't return file from generate()
The file is `self`
2012-10-17 00:37:02 -04:00
Matthew Tretter
ca324b7f52 Remove unused import 2012-10-17 00:32:31 -04:00
Matthew Tretter
41fa197212 Remove save kwarg--that's what generate() does! 2012-10-17 00:31:38 -04:00
Matthew Tretter
a08edaca56 Handle storage in BaseIKFile 2012-10-17 00:29:51 -04:00
Matthew Tretter
97d47c9c6c Remove generate_file. apply() does it all!
There was a lot of garbage in that method and I don't know why.
2012-10-17 00:23:38 -04:00
Matthew Tretter
77b33f757c Correct example 2012-10-17 00:07:29 -04:00
Matthew Tretter
4c4727fa9f Remove unused import 2012-10-17 00:07:29 -04:00
Matthew Tretter
63ad9e4421 Remove registration methods from template tag
The registry isn't just for template tags anymore.
2012-10-17 00:07:28 -04:00
Matthew Tretter
a93832626a Return string from render method
...instead of wrapping the file with an object that has a __unicode__
method. If you want the actual file, you should use the assignment form.
2012-10-17 00:07:23 -04:00
Matthew Tretter
9b81acd10c Don't pass removed argument 2012-10-16 23:52:31 -04:00
Matthew Tretter
5c6d1aef5d Rename ImageSpecFile
You can generate other "spec" files (using apply will get you one). This
one is for saving cache files and its name should reflect that.
2012-10-16 23:51:26 -04:00
Matthew Tretter
df8905f7e4 Remove unused imports 2012-10-16 23:39:10 -04:00
Matthew Tretter
738bbfa9a1 Move cache file naming into ImageSpecFile 2012-10-16 23:38:44 -04:00
Matthew Tretter
5ca8b7f4ba Rename process_file; don't return image object
This function will just be used to apply the spec and create a new file;
useful for transforming images in views, etc.
2012-10-16 22:59:40 -04:00
Matthew Tretter
fdc08aeeb0 Don't extend ImageFieldFile
This file isn't just for fields anymore, so we want to get rid of all
the ORM stuff.
2012-10-16 22:52:01 -04:00
Matthew Tretter
13b59ef85e Reorder methods 2012-10-16 22:33:17 -04:00
Matthew Tretter
a4ef8aa681 Add before_access signal 2012-10-16 22:30:36 -04:00
Matthew Tretter
3308c92a71 Remove SpecWrapper class
We don't need it now that we have an ImageSpec class
2012-10-16 22:23:14 -04:00
Matthew Tretter
37e0de3069 Move signals module 2012-10-16 22:10:52 -04:00
Matthew Tretter
8ef1437bea Remove apply() method 2012-10-16 22:06:24 -04:00
Matthew Tretter
1452f04cda Remove unused parameter 2012-10-16 22:03:50 -04:00
Matthew Tretter
7f6e97a37a Rename Pessimistic to JustInTime 2012-10-16 21:46:23 -04:00
Matthew Tretter
ca391fbf0a Change cache prefix 2012-10-16 21:43:17 -04:00
Matthew Tretter
80b723b510 Move IKContentFile to imagekit.files 2012-10-16 21:31:47 -04:00
Eric Eldredge
c0b79a227d Remove ImageSpecFieldFile in favor of ImageSpecFile 2012-10-15 23:53:05 -04:00
Eric Eldredge
2a33a2ad88 Fix circular import utils > imagecache.backends 2012-10-15 21:17:58 -04:00
Eric Eldredge
93409c8f05 SpecRegistry's spec can be callable (spec factory) 2012-10-14 21:35:07 -04:00
Eric Eldredge
461fbaef1a Processors no longer callable 2012-10-14 18:48:17 -04:00
Matthew Tretter
dc84144d6b Pass additional info with source signal 2012-10-14 16:08:48 -04:00
Matthew Tretter
7ce05f468a Pass attname to dispatch_signal
This allows any file object to be used--even those that don't have a
`field` attribute. For example, you could theoretically use one spec
field as a source for another.
2012-10-14 15:41:35 -04:00
Matthew Tretter
7447d147d4 Wire up source events to specs (and image cache strategies)
Also change signal names to past tense to match convention.
2012-10-13 01:16:05 -04:00
Matthew Tretter
cedd744e32 Add description of registry 2012-10-13 00:22:30 -04:00
Matthew Tretter
440fcb19ef Correct signal relaying 2012-10-12 23:43:51 -04:00
Matthew Tretter
a59330cf2c Add class description 2012-10-12 23:12:05 -04:00
Matthew Tretter
8a35b3a3dd Registration and connection of sources 2012-10-12 23:08:26 -04:00
Matthew Tretter
fe803f8981 Beginning to move functionality into "sources"
Before this is applied, we're going to have to make it so that the
image cache strategies are passed the source file, not the other file.
2012-10-10 00:18:54 -04:00
Matthew Tretter
06e5f45904 Remove unused imports 2012-10-04 23:43:02 -04:00
Matthew Tretter
667f0cc08e Simplify IMAGEKIT_CACHE_BACKEND setting 2012-10-04 23:41:20 -04:00
Matthew Tretter
436a73dc9a Remove image cache backend field registration 2012-10-04 23:28:55 -04:00
Matthew Tretter
5a1dd0c459 Don't require spec to be created up-front 2012-10-04 23:27:19 -04:00
Matthew Tretter
ce08448207 Rename register_spec() to set_spec_id() 2012-10-04 23:22:25 -04:00
Matthew Tretter
56c66f4883 Back ProcessedImageField with spec registry 2012-10-04 23:15:16 -04:00
Matthew Tretter
82d0e4be73 Remove unused imports 2012-10-04 23:03:22 -04:00
Matthew Tretter
f289ff3199 Back ImageSpecFields with spec registry
This marks a major step towards centralizing some of the "spec" logic
and creating a single access point for them. Because `ImageSpecFields`
are just alternative interfaces for defining and registering specs,
they can be accessed and overridden in the same manner as other specs
(like those used by template tags): via the spec registry.
2012-10-04 22:56:26 -04:00
Matthew Tretter
99ba61d605 Move spec registry 2012-10-04 22:02:29 -04:00
Matthew Tretter
116b0bc0c5 Move spec classes to specs module 2012-10-04 21:58:22 -04:00
Matthew Tretter
30ba1d890e Move exceptions 2012-10-04 21:57:33 -04:00
Matthew Tretter
0cc7938400 Re-integrate receivers module
Somewhere along the line, a change got merged that stopped using the
receivers module. This re-integrates it and moves changes made to the
old receivers (static methods on ImageSpecField) to them.
2012-10-04 21:44:55 -04:00
Matthew Tretter
d2087aa168 Create ImageSpecs; remove generators 2012-10-04 21:37:20 -04:00
Eric Eldredge
2e5489eb56 Merge branch 'ik-next' into templatetags
Conflicts:
	imagekit/models/fields/__init__.py
	imagekit/utils.py
2012-10-04 15:46:50 -04:00
Matthew Tretter
c8778b9cfb Remove print statement 2012-10-03 22:31:45 -04:00
Matthew Tretter
ba9bf1f877 Add image cache strategies
This new feature gives the user more control over *when* their images
are validated. Image cache backends are now exclusively for controlling
the *how*. This means you won't have to write a lot of code when you
just want to change one or the other.
2012-10-03 22:23:11 -04:00
Matthew Tretter
f43bd4ec28 Include source filename in hash 2012-09-15 15:09:58 -04:00
Eric Eldredge
ec9a1f1fda Spec templatetag returns html by default
...if no 'as var' is provided or if the var is printed directly.
2012-09-07 00:25:03 -04:00
Matthew Tretter
8a2738ca8a Add backend for caching image state 2012-09-06 22:11:23 -04:00
Matthew Tretter
2ad3791d9d Reorganize image cache backends 2012-09-06 09:11:18 -04:00
Matthew Tretter
3103ab29bd Remove "non-validating" backend
It's been superseded by the VALIDATE_ON_ACCESS setting
2012-09-06 09:10:05 -04:00
Matthew Tretter
0fc29ee7cf Extract useful backend utils 2012-09-06 09:09:30 -04:00
Matthew Tretter
197dfb3485 Add VALIDATE_ON_ACCESS setting 2012-09-06 09:08:45 -04:00
Eric Eldredge
bdecf75e0a Merge branch 'ik-next' into templatetags 2012-09-05 21:47:39 -04:00
Eric Eldredge
c50e6cea3b Merge branch 'develop' into templatetags
Conflicts:
	imagekit/utils.py
2012-09-05 21:46:59 -04:00
Matthew Tretter
c8733c4707 Change how signals are used
Signals are now connected without specifying the class and non-IK
models are filtered out in the receivers. This is necessary because of
a bug with how Django handles abstract models.

Closes #126
2012-07-25 23:04:21 -04:00
Matthew Tretter
23c6e9a70e Add __init__ to Reflection processor; closes #141 2012-07-25 22:20:15 -04:00
Matthew Tretter
7ad5cf4db5 Use hashes for generated image filenames
While this change means users can no longer specify their own filenames,
changing a property of a processor, for example, will now result in a
new image. This solves a lot of the previous invalidation issues.
2012-07-19 23:48:28 -04:00
Matthew Tretter
a196e00059 Use django-appconf 2012-07-19 21:03:15 -04:00
Matthew Tretter
548fb65618 Allow callables for AdminThumbnail image_field arg
This allows images from related models to be displayed. Closes #138.
2012-07-19 20:08:03 -04:00
Matthew Tretter
becee54c03 Fix pickling of ImageSpecFieldFile
Code now passes the test added in 118f6e4. Hopefully this will
address #97.
2012-07-18 22:25:26 -04:00
Matthew Tretter
c1b4c9bf71 Use cStringIO if available 2012-05-12 15:45:08 -04:00
German M. Bravo
89f2aa7a7d Reflections on images using RGBA 2012-05-12 15:39:36 -04:00
German M. Bravo
784afcc95d Simplified path join for the cache 2012-05-12 15:39:12 -04:00
Bryan Veloso
322c96eec2 Merge branch 'release/2.0.1' into develop
* release/2.0.1:
  Bumping the version number.
  Changelog update.
2012-04-28 11:32:22 -07:00
Jeroen Dekkers
69b590257d Do not leak file descriptor 2012-04-28 16:13:50 +02:00
Bryan Veloso
209afac9e3 Merge branch 'develop' into release/2.0
* develop:
  IKContentFile accepts format hint
  Additional mimetype utils
  Don't get extension of empty filename
  Tell people to import fields from the models module
  Refactored AutoConvert into prepare_image
  Docstring for save_image
  Kill PIL's chattiness; fixes #91
  PIL bug workaround
  Use StringIO instead of temp file
  Extract reusable save_image function
  Rename SpecFile and move it to utils
  Extract suggest_extension util from generator
  Woah, globals
  Add SpecFile.__unicode__
2012-04-24 13:59:28 -07:00
Matthew Tretter
89eb05668e IKContentFile accepts format hint 2012-04-20 23:30:30 -04:00
Matthew Tretter
b466ff3723 Additional mimetype utils 2012-04-20 23:27:35 -04:00
Matthew Tretter
7b34716d9e Don't get extension of empty filename 2012-04-20 23:26:58 -04:00
Matthew Tretter
af7c12cb68 Tell people to import fields from the models module 2012-04-20 21:43:59 -04:00
Matthew Tretter
667e265c94 Refactored AutoConvert into prepare_image
Because of its need to return kwargs for ``Image.save()``, it never
really fit the mold of a processor.
2012-04-20 21:37:43 -04:00
Matthew Tretter
222c9ba22a Docstring for save_image 2012-04-20 21:23:06 -04:00
Matthew Tretter
b6f629d644 Kill PIL's chattiness; fixes #91 2012-04-20 01:55:00 -04:00
Matthew Tretter
5fdf9d6a91 PIL bug workaround 2012-04-20 00:46:35 -04:00
Matthew Tretter
6f8a22c5bf Use StringIO instead of temp file 2012-04-20 00:46:33 -04:00
Matthew Tretter
e0c9708e63 Extract reusable save_image function 2012-04-20 00:46:08 -04:00
Matthew Tretter
7d5937ebe6 Rename SpecFile and move it to utils 2012-04-19 21:33:56 -04:00
Matthew Tretter
8044b97a33 Extract suggest_extension util from generator 2012-04-19 21:33:52 -04:00
Matthew Tretter
6e4a8d1b58 Woah, globals 2012-04-09 21:27:09 -04:00
Clay McClure
db4df4f82c Add SpecFile.__unicode__
SpecFile is based after django.core.files.base.ContentFile, which lacks a __unicode__
method. This leads to an AttributeError when SpecFile.__repr__ is called. This is
easily resolved by giving SpecFile a proper __unicode__ method.
2012-03-27 17:17:54 -04:00
Bryan Veloso
70f80ba7fa Bumping an version number. 2012-03-23 14:32:52 -07:00
Bryan Veloso
1c8987e353 Merge pull request #121 from cyberdelia/celery-improvements
Delete file before re-generating it
2012-03-23 13:04:22 -07:00
Timothée Peignier
39b2feda5a delete file before re-generating it to avoid ill named file 2012-03-23 12:13:53 +01:00
Timothée Peignier
bc7852be21 fix typo in celery backend 2012-03-20 20:06:41 +01:00
Bryan Veloso
c46a403baa Using Django's method of versioning. Also updating the docs' version. 2012-03-20 02:44:53 -07:00
Timothée Peignier
d1af56ba3e ensure task is correctly created 2012-03-15 10:37:28 +01:00
Timothée Peignier
1e4ac109f7 rename async to celery 2012-03-08 19:58:36 +01:00
Timothée Peignier
7af4940914 try to import celery on init 2012-03-05 17:47:19 +01:00
Timothée Peignier
f3976a5c68 change import path 2012-03-05 17:36:08 +01:00
Timothée Peignier
983bceff62 rename CeleryCacheStateBackend as CeleryImageCacheBackend 2012-03-05 17:00:35 +01:00
Timothée Peignier
9fbdd7bef4 import base backends in imagecache module 2012-03-05 16:55:40 +01:00
Timothée Peignier
0fa86f7da8 rename celery module to async 2012-03-05 13:58:09 +01:00
Timothée Peignier
42c79d7bb2 declare celery backends in a separate module 2012-03-05 12:27:53 +01:00
Clay McClure
2cf425d8a3 Wrap ContentFile in a file-like object with a filename and content_type.
This extra layer of indirection allows us to tack some attributes
(name and content_type) onto the underlying file, which we cannot
do with a StringIO since it's a native ctype.

These attributes are used by various third-party software that expects
to work with django.core.files.File instances, and not directly with
StringIO instances. By way of example, the django-storages mosso
backend (CloudFilesStorage) looks for a content_type attribute, and
the cloudfiles Object backend looks for a name attribute.
2012-02-29 05:01:31 -05:00
Matthew Tretter
3a5d7da0d8 Validate the image any time the file is required
This means that accessing `path` or `size` will also validate,
closing #109
2012-02-23 17:46:57 -05:00
Matthew Tretter
8fc71e689a Cover renamed to ResizeToCover 2012-02-18 01:38:19 -05:00
Matthew Tretter
e67934852d Rename processors and clean up packages 2012-02-18 00:20:44 -05:00
Matthew Tretter
3912003f02 Rename Fit and Fill to ResizeToFit and ResizeToFill 2012-02-18 00:05:18 -05:00
Matthew Tretter
5a8564d039 Rename BasicResize to Resize 2012-02-17 23:55:59 -05:00
Matthew Tretter
3fad906305 Remove crop.Crop to avoid confusion with resize.Crop 2012-02-17 23:54:39 -05:00
Matthew Tretter
3e2bd2f21f Crop processor consolidation
BasicCrop is absorbed into Crop and Crop uses ResizeCanvas
2012-02-17 23:22:56 -05:00
Matthew Tretter
a164427074 Don't use Anchor internals; allow any anchor tuple
ResizeCanvas now uses the anchor behavior of the Crop processor
2012-02-17 23:22:49 -05:00
Matthew Tretter
568c3d29a1 Default ResizeCanvas color 2012-02-17 22:39:43 -05:00
Matthew Tretter
6cca16ef99 Allow negative coordinates when using an anchor 2012-02-17 22:38:04 -05:00
Matthew Tretter
dd5efac0eb A little AddBorer cleanup 2012-02-17 22:38:00 -05:00
Matthew Tretter
441266a6d7 Small ResizeCanvas fixes 2012-02-17 22:34:40 -05:00
Jan Sagemueller
b073868bb7 AddBorder, Anchor, and ResizeCanvas processors
[NEW] Processors: AddBorder
[NEW] Processors: Anchor has now its own class, taken from Crop
[CHG] Processors: Renamed Mat => ResizeCanvas, and will now use either
an anchor from Anchor or a user defined pixel offset
2012-02-17 21:48:32 -05:00
Jan Sagemueller
09ecbae143 Resize processor: Externalized transparency padding into new class Mat
Conflicts:

	imagekit/processors/resize.py
2012-02-17 21:47:24 -05:00
Matthew Tretter
b016065807 Fix inheritance of ImageKitMeta objects
Fixes #100
2012-02-17 21:10:09 -05:00
Matthew Tretter
84d36791b8 Pass the pickle test; should fix #97 2012-02-17 20:07:50 -05:00
Matthew Tretter
677c52b730 Rename descriptor and file to match Django 2012-02-17 18:39:51 -05:00
Matthew Tretter
6816196da7 Use "super" 2012-02-17 18:22:05 -05:00
Eduard Iskandarov
fa244cdcc9 fix unicode error 2012-02-16 19:47:22 +06:00
Bryan Veloso
dafbe2040d The serial must be greater than 0 for an alpha release. Fixes #101. Thanks @vesterbaek! 2012-02-15 12:57:36 -08:00
Bryan Veloso
a004071e27 We're in 2.0alpha now, really. 2012-02-14 11:18:36 -08:00
Timothée Peignier
98066eea93 fix import and formatting 2012-02-14 17:34:51 +01:00
Matthew Tretter
938acedcc7 Decorator syntax for registering specs 2012-02-13 22:13:32 -05:00
Matthew Tretter
722a553501 Automatically autodiscover 2012-02-13 22:12:34 -05:00
Matthew Tretter
d275aaa3f7 A little reorganization 2012-02-13 22:12:07 -05:00
Matthew Tretter
807beef418 Centralized spec properies 2012-02-13 21:49:09 -05:00
Matthew Tretter
6a1a22825b Working proof of concept of spec tag 2012-02-13 21:49:09 -05:00
Matthew Tretter
3a3f941e2c Pull field utilities out into their own module 2012-02-13 21:47:53 -05:00
Matthew Tretter
8cdbd96a1f Add files module 2012-02-13 21:44:29 -05:00
Matthew Tretter
c2891090d1 Remove old handlers
They somehow got re-added along the way
2012-02-13 21:38:40 -05:00
Matthew Tretter
b71102e7e8 Correct indentation error 2012-02-13 21:16:45 -05:00
Matthew Tretter
e71432d8ed Undo "return content" removal
I changed my mind. For now, at least.
2012-02-12 17:23:55 -05:00
Matthew Tretter
e31080ff4a Moved SpecFileGenerator to new module 2012-02-12 17:23:53 -05:00
Matthew Tretter
d9abd75d8a Pass storage to generator 2012-02-12 17:23:40 -05:00
Matthew Tretter
ff1b76f923 Remove image cache backend from generator 2012-02-12 17:23:40 -05:00
Matthew Tretter
a668b28257 Fix ProcessedImageField bug
Was using an old method signature
2012-02-12 17:23:40 -05:00
Matthew Tretter
b24fe7b8e0 Cleanup 2012-02-12 17:23:40 -05:00
Matthew Tretter
2a422f5cb6 Decouple generator from model 2012-02-12 17:23:39 -05:00
Matthew Tretter
1054d055fb Rename generate_content to process_content 2012-02-12 17:23:39 -05:00
Matthew Tretter
a7cf79290c Don't return content 2012-02-12 17:23:39 -05:00
Matthew Tretter
4ab5aadec6 Remove process method 2012-02-12 17:23:39 -05:00
Matthew Tretter
146a5ee01c Access generator through field 2012-02-12 17:23:39 -05:00
Matthew Tretter
7d6036aaac Remove cache_to from generator 2012-02-12 17:23:39 -05:00
Matthew Tretter
71c56c7d6a Separate generator 2012-02-12 17:23:39 -05:00
Matthew Tretter
fe1bfa4d1a Fix conflict resolution issues 2012-02-12 17:06:37 -05:00
Bryan Veloso
424659bd07 Merge pull request #95 from jdriscoll/new_processors
New processors
2012-02-12 13:54:12 -08:00
Bryan Veloso
5a31e98b2f Merge remote-tracking branch 'matthewwithanm/whencontrol' into develop
* matthewwithanm/whencontrol:
  Rename cache_state_backend to image_cache_backend
  Add NonValidatingCacheStateBackend
  Some documentation
  Only invalidate spec file if source changes
  Rename DefaultCacheStateBackend
  generate method (optionally) saves file
  Rename force flag to force-revalidation
  Add clear method for when future validation is unwanted
  Commands for validating and invalidating the cache
  Fix var name typo
  Spec files now accessible through _ik attr
  Remove unused import
  First shot at cache state backend implementation

Conflicts:
	imagekit/models/fields.py
2012-02-12 13:48:02 -08:00
Matthew Tretter
e9e364eedd Rename cache_state_backend to image_cache_backend
Related names (like the package and class names) have also been
updated.
2012-02-12 16:18:34 -05:00
Matthew Tretter
2838fa47cd Created "fields" module
This should give us a little more structure as IK grows.
2012-02-12 14:53:49 -05:00
Matthew Tretter
cf821cfecd Documentation 2012-02-11 15:40:16 -05:00
Matthew Tretter
80a26a4f09 Rename crop function to show it's internal 2012-02-11 15:33:25 -05:00
Matthew Tretter
4278a95001 Use BasicCrop in other processors 2012-02-11 15:32:23 -05:00
Matthew Tretter
51212749e9 Improve BasicCrop API as discussed in #94 2012-02-11 15:28:47 -05:00
Matthew Tretter
15e0981835 Use BasicResize for resizing 2012-02-11 15:26:27 -05:00
Matthew Tretter
1a999f23da @madisvain's BasicResize from #94 2012-02-11 15:25:10 -05:00
Matthew Tretter
75db5db073 Default anchor to CENTER
This was accidentally lost in 88cda1b0b3.
2012-02-11 15:16:28 -05:00
Matthew Tretter
57056c021d Add SmartFill processor
The simplicity is what makes it so attractive.
2012-02-11 15:12:24 -05:00
Matthew Tretter
ce7353b0bd Extract Cover processor from Fill
This will also be used by `SmartFill`, so we might as well centralize it.
2012-02-11 15:01:59 -05:00
Matthew Tretter
88cda1b0b3 Clean up Crop processor
Also, finally allowing arbitrary anchors (specified in percentages).
2012-02-11 14:52:43 -05:00
Matthew Tretter
b4b64a4863 Avoid duplication of cropping code
`Fill` is just a resize followed by a crop, so we might as well make
use of the processors we already have.
2012-02-11 14:25:06 -05:00
Matthew Tretter
16110a0f1c Remove print statement 2012-02-11 14:13:57 -05:00
Matthew Tretter
1ffc8ca81e Remove duplicate resize.Crop
`resize.Crop` actually hasn't been moved to `crop.Crop` (as the removed
class claimed). In fact, what used to be called `resize.Crop` is now
`resize.Fill`. The confusion is understandable, since it's what
motivated the change in the first place!
2012-02-11 14:11:07 -05:00
Madis Väin
6dd0d2272f write the processors talked about in issue #93 2012-02-11 13:50:12 -05:00
Matthew Tretter
2467dfe912 Rename resize.Crop to resize.Fill 2012-02-11 13:36:30 -05:00
Matthew Tretter
c3ef5172c3 Rename ImageSpec to ImageSpecField
The ImageSpec class remains for now, but using it throws
deprecation warnings.
2012-02-11 13:06:48 -05:00
Matthew Tretter
15b15afe2c Add NonValidatingCacheStateBackend 2012-02-11 00:42:56 -05:00
Matthew Tretter
164a4e11fc Some documentation 2012-02-11 00:15:58 -05:00
Matthew Tretter
1956e16b4b Only invalidate spec file if source changes 2012-02-11 00:04:56 -05:00
Matthew Tretter
60a8c06336 Rename DefaultCacheStateBackend
PessimisticCacheStateBackend more accurately describes what is is,
instead of how it's used.
2012-02-10 22:08:13 -05:00
Matthew Tretter
c2a4d01b7c Only one return 2012-02-10 22:04:20 -05:00
Matthew Tretter
09b97ee62f Move SmartCrop to crop module
Addresses one of the issues raised by in @madisvain in #93
2012-02-10 19:42:36 -05:00
Jan Sagemueller
a041302c96 Resize processor: Add mat_color option to enforce the targeted image size 2012-02-08 09:25:37 -05:00
Matthew Tretter
35b807cfa9 generate method (optionally) saves file
This way, there's a creation counterpart to `delete()`. The user
shouldn't have to deal with storage backends to create and delete the
files, and now they don't.
2012-02-03 09:16:50 -05:00
Matthew Tretter
513b23b169 Rename force flag to force-revalidation 2012-02-02 23:23:20 -05:00
Matthew Tretter
011c0c2e5f Add clear method for when future validation is unwanted 2012-02-02 23:21:00 -05:00
Matthew Tretter
8b6ba687e4 Commands for validating and invalidating the cache 2012-02-02 00:19:46 -05:00
Matthew Tretter
c4fc09c688 Fix var name typo 2012-02-02 00:08:22 -05:00
Matthew Tretter
a668df1c37 Spec files now accessible through _ik attr 2012-02-01 23:26:39 -05:00
Matthew Tretter
a1638127cf Remove unused import 2012-02-01 22:41:33 -05:00
Matthew Tretter
62ff07bf1f First shot at cache state backend implementation 2012-02-01 22:37:58 -05:00
Timothée Peignier
eb801d75f5 small pep8 formatting fix 2012-01-27 13:45:22 +01:00
Matthew Tretter
343f14ad48 Use old-style string formatting 2012-01-26 18:19:39 -05:00
Timothée Peignier
3bac472561 ImageSpec accepts callable processors arg 2012-01-26 11:01:58 -05:00
Matthew Tretter
6333ee5d05 Makes Adjust transparency-compatible
And closes #64!
2012-01-03 18:57:32 -05:00
Bryan Veloso
3bacd51ba5 Bumping the version number. 2011-12-22 22:14:14 -08:00
Matthew Tretter
e574f1190f Merge pull request #73 from cyberdelia/fix-transpose-exif
Catch error when exif data doesn't exist
2011-12-07 21:37:48 -08:00
Matthew Tretter
dd28557323 Change handling of spec deletion
Though it's not the case with `FileSystemStorage`, attempting to delete
a nonexistent file can cause an exception (as in #80). We want to avoid
these errors but don't want to suppress others raised in the process of
deleting the file, so we first check to see if the file exists.
2011-12-07 00:52:06 -05:00
Matthew Tretter
081a0a0d0f No need to check for None
`get_spec_files` will never return it.
2011-12-07 00:37:52 -05:00
Kevin Postal
eda3fc3c91 Catch KeyError on image.info dictionary 2011-12-06 23:29:30 -05:00
Matthew Tretter
8bab75b331 Merge pull request #66 from matthewwithanm/trimcolor-processor
Processor for trimming solid-color borders
2011-12-06 10:04:39 -08:00