sorl-thumb 不制作缩略图
我不知道我做错了什么,但 sorl-thumb 只是上传图像但不制作拇指...
model.py
from sorl.thumbnail.fields import ImageWithThumbnailsField ,ThumbnailField
imagen = ImageWithThumbnailsField(upload_to='images',
thumbnail={'size': (75, 75)},
extra_thumbnails={'icon': {'size': (25, 25),'options': ['crop', 'upscale']},
'large': {'size': (200, 400)},
},
)
设置
'sorl.thumbnail',
我还需要什么?我已按照文档进行操作。
I don't know what I'm doing wrong, but sorl-thumb just uploads the image but doesn't make thumbs...
model.py
from sorl.thumbnail.fields import ImageWithThumbnailsField ,ThumbnailField
imagen = ImageWithThumbnailsField(upload_to='images',
thumbnail={'size': (75, 75)},
extra_thumbnails={'icon': {'size': (25, 25),'options': ['crop', 'upscale']},
'large': {'size': (200, 400)},
},
)
setting
'sorl.thumbnail',
What more do I need? I've followed the documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否阅读过有关何时创建缩略图的文档?
您实际上还没有准确解释您的问题是什么。编辑您的原始问题以显示您正在尝试执行的操作(以及实际结果和预期结果)。
编辑:
正如文档所说,您的图像在使用之前不会被创建。如果您希望在初次上传图像时生成拇指,请使用
generate_on_save
属性,如下所示:Did you read the documentation on when thumbnails are created?
You haven't actually explained exactly what your problem is. Edit your original question to show something you are trying to do (along with both the actual and expected results).
EDIT:
As the docs say, your images are not created until they are used. If you want thumbs to be generated when the image is initially uploaded, use the
generate_on_save
attribute like this:我不知道 sorl,但我想说,您需要添加
ImageWithThumbnailsField
作为模型内的字段sorl 文档中的 ImageWithThumbnailsField
I dont know sorl, but I would say, you need to add
ImageWithThumbnailsField
as a field inside a modelImageWithThumbnailsField in sorl-documentation