Reputation: 709
ImageKit has given me quite the headache over the last few days. I had an internal server error on my site because I followed the example ImageSpecField on the GitHub page:
avatar_thumbnail = ImageSpecField(source='avatar',
processors=[ResizeToFill(100, 50)],
format='JPEG',
options={'quality': 60})
The resultant error was:
TypeError: __init__() got an unexpected keyword argument 'source'
So, I updated the avatar_thumbnail to use the example ImageSpecField on the ReadTheDocs page:
avatar_thumbnail = ImageSpecField(image_field='avatar',
processors=[ResizeToFill(100, 50)],
format='JPEG',
options={'quality': 60})
And then I got the error:
TypeError: __init__() got an unexpected keyword argument 'image_field'
It's odd that when I use 'source' the app will run locally successfully with no error. On the server the app runs with 'image_field' without an internal error, but still doesn't actually create or display the avatar image. Both the server and local have version 2.0.4 of django-imagekit installed.
Any advice would be wonderful.
Upvotes: 1
Views: 1496
Reputation: 4142
I'm one of the maintainers of ImageKit. I think the first issue is that you were looking at the docs for the development version (on GitHub), but using the latest stable release (from PyPI). The development version is currently 3.0b and some things have changed from the 2.x series—one of them being that the image_field
argument was renamed to source
. (Within the next week or so, we'll be dropping the "beta," pushing 3.0 to PyPI, and updating the "latest" docs on RTD.)
With that corrected, the thumbnail should be generated automatically when you access the thumbnail's url property (which is usually done in a template in order to display the image).
Hope this helps.
Upvotes: 4