Commit graph

39 commits

Author SHA1 Message Date
Leonardo
595f7b35ef Enhance condition in _get_size (#463)
This fix the issue #326.
2018-04-24 15:48:43 +03:00
Venelin Stoykov
d86ec082f1 Fixed #350: Error when trying to access width/height after url
If the file is closed and something is calling `open` now the file will be opened correctly event if it was already closed
2016-07-17 05:08:01 +03:00
Venelin Stoykov
0575011529 Add Python 3 suport and drop support for Python 2.5 2013-08-19 21:27:50 +03:00
Matthew Tretter
d6b73b8da7 Renaming/repackaging of generated file related classes 2013-01-31 19:24:08 -05:00
Matthew Tretter
8e6abc1e65 Remove ensure_exists
`generate()` now plays double duty
2013-01-31 10:07:27 -05:00
Matthew Tretter
04aa72c1f9 Rename cache things (it isn't cachine)
https://twitter.com/alex_gaynor/statuses/257558176965206016
2013-01-31 10:07:20 -05:00
Matthew Tretter
3931b552a0 Separate source groups and cacheables.
This allows a sensible specialized interface for source groups, but also
for ImageKit to interact with specs using the generalized image
generator interface.
2013-01-29 01:40:00 -05:00
Matthew Tretter
5b44564318 Add LazyGeneratedImageCacheFile 2013-01-28 21:46:04 -05:00
Matthew Tretter
234082e63c Extract generate() util, to make files Django likes 2013-01-23 22:34:29 -05:00
Matthew Tretter
d632fc70fa Copy contents to NamedTemporaryFile if generated file has no name 2013-01-23 21:27:21 -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
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
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
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
6377f89e85 IKContentFile must have name attr 2012-10-25 22:43:10 -04:00
Matthew Tretter
aa91a70e46 Make specs know less about source files 2012-10-20 22:53:55 -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
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
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
738bbfa9a1 Move cache file naming into ImageSpecFile 2012-10-16 23:38:44 -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
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
Matthew Tretter
d2087aa168 Create ImageSpecs; remove generators 2012-10-04 21:37:20 -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
d275aaa3f7 A little reorganization 2012-02-13 22:12:07 -05:00
Renamed from imagekit/base.py (Browse further)