Commit graph

877 commits

Author SHA1 Message Date
Bryan Veloso
6c87d7deac Merge branch 'release/0.4.1' into develop
* release/0.4.1:
  Discontinuation notice.
2011-10-31 22:43:13 +09:00
Bryan Veloso
1900248842 Merge branch 'release/0.4.1'
* release/0.4.1:
  Discontinuation notice.
  Future-proofing our PIL imports, fixes #37.
  Whitespacing and PEP8-ing.
  Clearing out some unused imports.
  We no longer import *.
  Prefer cStringIO.
  Killing off some stray tabs.
  Changed id to pk in case the primary key isn't called 'id'
  Adding Ryan to AUTHORS.
  dynamically getting colors, instead of setting it to 255
  adding transparency patch to preserve transparency when saving the image
  Making versioning a little easier on myself.
  error fix: https://github.com/jdriscoll/django-imagekit/issues/25
  Fixing some spelling. Fixes #29. Thanks Nai!
  Tests now pass and don't leave any directory cruft. Fixes #28.
  Adding a test runner script a la #daniellindsleyrocksdahouse.
  Creating a "core" test module.
  Creating a dedicated tests directory.
  Let's get these docs started.
  Added support for preserving transparency when converting from color to greyscale
2011-10-31 22:42:24 +09:00
Bryan Veloso
47fac1cb07 Discontinuation notice. 2011-10-31 22:41:43 +09:00
Chris McKenzie
714ff8ae1d adding introspection rule for users with south 2011-10-24 18:18:25 -04:00
Bryan Veloso
6adadafc74 PEP8 and import tweaks. 2011-10-20 12:12:47 +09:00
Bryan Veloso
302399d837 Merge branch 'new_api' of https://github.com/matthewwithanm/django-imagekit into release/1.0.0
* 'new_api' of https://github.com/matthewwithanm/django-imagekit: (63 commits)
  fixing typo
  ImageSpecFile is a proper File
  Typo fix
  A list of ImageSpec names are now stored on the model.
  AdminThumbnailView is now AdminThumbnail
  Docs typo fix
  Adds explicit import of resize module to processors
  fixing bad import in docs
  adding name to AUTHORS
  adding test for new api
  Moved Crop and Fit to resize module.
  More docs edits.
  Typo fix.
  Installation instructions.
  Embracing duck typing.
  Documentation!
  Fix bug
  Bound fields are now cached on the model instance.
  Transpose processor now supports auto EXIF orientation.
  Fix filename formatting.
  ...

Conflicts:
	AUTHORS
	README.rst
	docs/Makefile
	docs/conf.py
	docs/index.rst
	imagekit/__init__.py
	imagekit/defaults.py
	imagekit/management/commands/ikflush.py
	imagekit/models.py
	imagekit/options.py
	imagekit/processors.py
	imagekit/specs.py
	tests/core/tests.py
2011-10-20 12:06:10 +09:00
Chris McKenzie
79a6e8f1ab fixing typo 2011-10-17 10:27:29 -04:00
Bryan Veloso
56d8b80a12 Future-proofing our PIL imports, fixes #37. 2011-10-13 14:35:16 +09:00
Matthew Tretter
8147cb85df ImageSpecFile is a proper File
Previously, ImageSpecFile was a file-like object, but didn't actually
extend any of the file classes. Because of this, some of Django's file-
handling code was duplicated. More importantly, instances didn't always
behave as one might expect (if one were familiar with ImageFields),
particularly when the source image was empty. This could have been
especially confusing in templates. (For example, because
ImageSpecFields whose source images didn't exist were still truthy.)
2011-10-10 17:22:06 -04:00
Matthew Tretter
7f7141ef27 Typo fix 2011-10-10 17:21:59 -04:00
Bryan Veloso
2d4f116e57 Whitespacing and PEP8-ing. 2011-10-11 02:16:22 +09:00
Bryan Veloso
f0269831fd Clearing out some unused imports. 2011-10-11 02:13:31 +09:00
Bryan Veloso
0ddff78068 We no longer import *. 2011-10-11 02:10:38 +09:00
Bryan Veloso
5e72d9f5e4 Prefer cStringIO. 2011-10-11 02:08:05 +09:00
Bryan Veloso
db86d7ed66 Killing off some stray tabs. 2011-10-11 01:12:30 +09:00
Bryan Veloso
00049abc95 Merge pull request #36 from jammons/develop
Changed id to pk in case the primary key isn't called 'id'
2011-10-10 00:37:18 -07:00
Jeff Ammons
2a37d7bfdc Changed id to pk in case the primary key isn't called 'id' 2011-10-06 16:15:26 -07:00
Eric Eldredge
b8e57dccd6 A list of ImageSpec names are now stored on the model.
Previously, ImageSpecFile instances were retrieved (for saving and deleting,
among other possibilities) by iterating over the model instance's attributes.
This change adds ImageSpecFile names to a list (spec_file_names) on an
imagekit meta object on the model (_ik), making later retrieval much cheaper
and more straightforward.
2011-10-06 16:08:14 -04:00
Matthew Tretter
b9aa69e0c0 AdminThumbnailView is now AdminThumbnail
I never liked that the "AdminThumbnailView" was supposed to be defined
on the model, but never looked into it.

This commit puts the definition back where it belongs: in the admin.
Instead of requiring you to add a field (with view logic) to your
model, you now just add a property to your admin class and specify
that property in the `list_display` list.
2011-10-02 21:58:08 -04:00
Matthew Tretter
067217e40e Docs typo fix 2011-09-26 16:52:35 -04:00
Eric Eldredge
67477a6e15 Adds explicit import of resize module to processors
This way users can write 'from imagekit.processors import *' and also use the
resize processors like so: 'resize.Crop(50, 50)'
2011-09-26 16:45:45 -04:00
Chris McKenzie
492febf7ec fixing bad import in docs 2011-09-26 16:40:38 -04:00
Chris McKenzie
9e9665f626 adding name to AUTHORS 2011-09-26 16:39:45 -04:00
Chris McKenzie
6412e40c69 adding test for new api 2011-09-26 16:38:55 -04:00
Matthew Tretter
da00e2a5da Moved Crop and Fit to resize module.
Crop doesn't necessarily imply the any scaling is taking place. Several
ideas were discussed, from renaming Crop to combining both processors
into a single Resize processor (as they were in the original IK), but
those solutions were felt to either precluded future extension
(alternative resize modes) or make the API too verbose.
2011-09-26 14:40:48 -04:00
Matthew Tretter
6751d78504 More docs edits.
Added us to the authors. Reorganized some of the documentation so that
sphinx and the project landing page on github can share it.
2011-09-26 11:36:08 -04:00
Bryan Veloso
6efd21e9b4 Adding Ryan to AUTHORS. 2011-09-26 12:07:37 +02:00
Bryan Veloso
cec46b3176 Merge pull request #32 from ryanbagwell/develop
Trasparency preservation patch
2011-09-26 03:06:04 -07:00
Matthew Tretter
9b9d9ec1c4 Typo fix. 2011-09-26 00:06:05 -04:00
Matthew Tretter
32c6f0c05f Installation instructions. 2011-09-25 23:38:23 -04:00
Matthew Tretter
6adbef3475 Embracing duck typing.
ImageProcessor didn't do anything. I'd rather get it out of there to reduce the
temptation for future IK contributors to do type checking and mess up peoples'
custom processors.
2011-09-25 23:24:44 -04:00
Matthew Tretter
d6632c95f5 Documentation! 2011-09-25 21:04:11 -04:00
Ryan Bagwell
ff07e4e247 dynamically getting colors, instead of setting it to 255 2011-09-25 17:53:51 -05:00
Ryan Bagwell
b96a3f53a5 adding transparency patch to preserve transparency when saving the image 2011-09-25 15:49:32 -05:00
Matthew Tretter
51144daeb6 Fix bug
Eric's fixes in c00ea10b0a meant that
some of the code that already existed to reuse objects would actually
be run for the first time. Naturally, there were some bugs; namely, I
was storing a filename (instead of a File object) in `_file` and a bad
else clause.
2011-09-25 16:18:52 -04:00
Eric Eldredge
c00ea10b0a Bound fields are now cached on the model instance.
ImageSpecFile and AdminThumbnailView are created on the first access, and
then assigned as properties of the model instance for subsequent access.
2011-09-25 12:42:27 -04:00
Eric Eldredge
f570bd0d7f Transpose processor now supports auto EXIF orientation.
Replaced calls to Image.open with an open_image utility function.
The open_image utility calls Image.open, but then wraps the opened Image's
copy method with a version that preserves EXIF data. This allows an
ImageSpec to copy the original image, yet still provide all the original
image's exif data to the processor pipeline.
2011-09-24 23:09:49 -04:00
Matthew Tretter
c694ba644f Fix filename formatting. 2011-09-24 02:04:23 -04:00
Matthew Tretter
6ae4f56ed7 Eliminate repetition in File objects. 2011-09-24 02:04:23 -04:00
Matthew Tretter
f9c4d6b500 Cleanup.
Centralized access of _img, tried to reduce re-calculation of some
properties, renamed _imgfield to source_file to reflect the fact that
it's an ImageFieldFile and not an ImageField.
2011-09-24 02:04:23 -04:00
Matthew Tretter
cc96ba5198 Moved _get_imgfile() into _create()
That was the only place it was being called and it just led to (my)
confusion with the image property.
2011-09-24 02:04:23 -04:00
Eric Eldredge
8a0bc084fe Processors no longer take a file argument.
They only get the image to process now.
2011-09-23 21:25:47 -04:00
Eric Eldredge
d99bf5327b Transpose processor has a new API.
Transpose now takes transposition constants as arguments. Multiple
transpositions can be sequenced together in one Transpose processor.
Auto transposition is not yet supported (PIL strips the EXIF data, so need to
find a workaround for getting that data to the processor).
2011-09-23 21:23:21 -04:00
Matthew Tretter
7e20b75ced Processors don't care about format.
The process of choosing an image format has been cleaned up and
Processors' role in determining the format has been removed.

Previously, processors would return a tuple containing the modified
image and the format. Other parts of IK overrode PIL's Image.format
with the target format, although that had no effect on PIL and the fact
that it didn't throw an error was just lucky.
2011-09-23 20:18:51 -04:00
Matthew Tretter
15e49be719 Extracted ProcessorPipeline
Pulled some functionality out of _ImageSpecMixin into the ProcessorPipeline
class so it could be used independently of the model-related stuff.
2011-09-23 19:12:04 -04:00
Matthew Tretter
e190e78df5 Rename fields module to models. 2011-09-23 18:06:28 -04:00
Matthew Tretter
3f7ca512af Extension argument to cache_to includes dot.
It seems that's how we do it in python world. Who am I to argue?
2011-09-23 12:44:53 -04:00
Eric Eldredge
77459eae73 Pared down the _post_save_handler.
The original handler implementation ported code from the old ImageModel's
save method, but ended up duplicating the efforts of the ImageSpecFile's
_create method.
2011-09-22 19:44:47 -04:00
Matthew Tretter
3d810e7be5 Rename ImageSpecFile properties
`_obj` and `_spec` are now `instance` and `field`, to match FieldFile.
2011-09-22 18:13:32 -04:00
Matthew Tretter
0ef56e1aaa process() accepts file
In the old IK API, processors (like `Transpose`) were able to access
the file by inspecting the model instance (which carried an options
object that specified the attribute name of the ImageField from which
the file could be extracted). Since the new API allows for multiple
ImageFields (and because IKOptions have been removed), it became
necessary to provide more information. Initially, this was accomplished
by passing the spec to `process()`, however with the addition of
ProcessedImageField, it became clear the a cleaner solution was to pass
only the field file (ImageSpecFile or ProcessedImageFieldFile).

This keeps the ORM stuff (fields, etc.) out of the `ImageProcessor` API
but (because field files, not just regular files, are passed) the
average hacker can still have their processor make use of model
information by accessing the model through the file's `instance`
property.
2011-09-22 17:58:33 -04:00