我有点困惑,我无法理解如何使用cmsplugin_filer_image为文本中的图像添加自定义样式?
我已按照此处的说明操作:https://github.com/stefanfoulis/cmsplugin-filer#customisation
被困在我必须将css添加到boxed.html的那一刻。我正在使用<<link rel="stylesheet" href="static/cmsplugin_filer_image/css/boxed.css">
,现在无法理解从boxed.css
以下是boxed.html
代码(我已将其从default.html复制并放置在我的应用目录中,例如project_y/src/templates
:
{% load thumbnail filer_tags filer_image_tags %}{% spaceless %}
{% comment %}
You may change the image size for special cases in your project by overriding
this template. There are a few size manipulation filters for this in
`filer_image_tags`:
{% if placeholder == 'my_special_sidebar' %}
{% thumbnail instance.image opts.size|extra_padding_y:10 crop=opts.crop upscale=opts.upscale as thumbnail %}
{% else %}
{% thumbnail instance.image opts.size crop=opts.crop upscale=opts.upscale as thumbnail %}
{% endif %}
{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %}>{% endif %}<img{% if instance.alignment %} class="{{ instance.alignment }}"{% endif %} alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />{% if link %}</a>{% endif %}
{% endcomment %}
{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %} class="filer_image_link">{% endif %}
{% if instance.image %}
{% if instance.use_original_image %}
<img class="filer_image {% if instance.alignment %}{{ instance.alignment }}{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% else %}
{% thumbnail instance.image size crop=opts.crop upscale=opts.upscale subject_location=opts.subject_location as thumbnail %}
<img class="filer_image {% if instance.alignment %}{{ instance.alignment }}{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% else %}
{# just a plain link to some external image #}
<img class="filer_image {% if instance.alignment %}{{ instance.alignment }}{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image_url }}"{% if size.0 %} width="{{ size.0 }}"{% endif %}{% if size.1 %} height="{{ size.1 }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% if instance.caption or instance.description %}
<span class="filer_image_info">
{% if instance.caption %}<span class="title">{{ instance.caption }}</span>{% endif %}
{% if instance.description %}<span class="desc">{{ instance.description }}</span>{% endif %}
</span>
{% endif %}
{% if link %}</a>{% endif %}
{% endspaceless %}
答案 0 :(得分:0)
最后,我决定将float:left
添加到网页中的所有图片中。可以在bootstrap.css
或bootstrap.min.css
img
类中完成。