Django Imagekit处理原始图像 [英] Django Imagekit processing the original image
问题描述
使用版本1.1,我不明白我可以如何预处理原始图像(由JUST使用imagekit)
With version 1.1 I don't understand how I can preprocess the original image (by JUST using imagekit)
https://github.com/jdriscoll/django-imagekit/blob/develop/README.rst
拥有如下模型:
class Photo(models.Model):
original = models.ImageField(etcetera)
thumbnail = ImageSpec(etcetera)
我如何调整原始图像的大小?这可能是在以前的成功案例中,但是文件暗示我需要另一个modelfield?
How do I for instance resize the original image? This was possible in previous imagekits, however the documentation insinuates I need another modelfield?
推荐答案
您可以使用 processedImageField
:
from imagekit.models import ProcessedImageField
class Photo(models.Model):
original = ProcessedImageField(etcetera)
有这个类的代码文档,但它看起来像 readthedocs 'autodoc模块现在没有被接受。
There is in-code documentation on this class, but it looks like it's not being picked up by readthedocs' autodoc module right now.
我重新打开了一个错误来修复文档。
I reopened a bug to fix the documentation.
这篇关于Django Imagekit处理原始图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!