django easy-thumbnail不工作,枕头不是造成的 [英] django easy-thumbnail not working, pillow isn't causing it

查看:165
本文介绍了django easy-thumbnail不工作,枕头不是造成的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么它不工作

I'm not sure why it's not working

设置文件

THUMBNAIL_DEBUG = True
THUMBNAIL_ALIASES = {
    'image': {
        'standard': {
            'size': (70, 70),
            'crop': True,
        }
    }
}

索引.html
我加载缩略图
然后

Index.html I load thumbnail then

 <img src="{{ post.image|thumbnail_url:'standard' }}" alt=""/></img>


推荐答案

我从未使用过 THUMBNAIL_ALIASES 但这种方式总是适合我:

I never used THUMBNAIL_ALIASES but this way always worked for me:

{% load thumbnail %}

{% thumbnail post.image as im %}
    <img src="{{ im.url }}">
{% endthumbnail %}

btw,您的 img 标签是错误的。

btw, your img tag is wrong.

这篇关于django easy-thumbnail不工作,枕头不是造成的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆