【问题标题】:django-imagekit tutorial fail - not creating thumbnailsdjango-imagekit 教程失败 - 不创建缩略图
【发布时间】:2011-06-08 21:38:05
【问题描述】:

我已经按照this tutorial 进行了尝试,但失败了。我已经按照教程中的方式复制了所有内容完全正确。问题是 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'

【问题讨论】:

  • 原来是这个版本的bug。

标签: django django-imagekit


【解决方案1】:

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

真正易于使用且易于遵循的教程: http://effbot.org/imagingbook/image.htm

【讨论】:

  • 我也使用 PIL,而且很简单。 Image.open('/path/to/image').thumbnail(500, 300), Image.ANTIALIAS)
  • 除了只有 PIL 没有缓存
猜你喜欢
  • 1970-01-01
  • 2021-11-04
  • 2023-03-31
  • 1970-01-01
  • 2014-10-04
  • 2012-06-05
  • 1970-01-01
  • 2013-07-30
  • 2011-05-02
相关资源
最近更新 更多