0

我已经按照本教程进行了尝试,但失败了。我已经完全按照教程中的方式复制了所有内容。问题是 ImageKit 没有创建缩略图(显示和缩略图图像)。

这里有一些细节:

>>> from myapp.models import Photo
>>> p = Photo.objects.all()[0]
>>> p.original_image.url
'photos/lena.jpg'
>>> p.display.url
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'Photo' object has no attribute 'display'
>>> p.thumbnail_image.url
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'Photo' object has no attribute 'thumbnail_image'
4

1 回答 1

2

您应该考虑使用 PIL 创建缩略图: http: //www.pythonware.com/products/pil/

真的很容易使用,而且很容易遵循教程: http ://effbot.org/imagingbook/image.htm

于 2011-06-08T22:43:38.240 回答