0
썸네일의 자르기 위치를 지정하기 위해 모델에 필드를 추가했지만 템플릿 태그에 추가 할 수 없습니다.sorl.thumnail에서 동적 자르기 설정하기
{% if entry.main_image.crop_value == "center" %}
{% thumbnail entry.main_image.image "350x100" crop="center" as im %}
<a href="{{ entry.get_absolute_url }}"><img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" alt=""></a>
{% endthumbnail %}
{% elif entry.main_image.crop_value == "top" %}
{% thumbnail entry.main_image.image "350x100" crop="top" as im %}
<a href="{{ entry.get_absolute_url }}"><img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" alt=""></a>
{% endthumbnail %}
{% elif entry.main_image.crop_value == "bottom" %}
{% thumbnail entry.main_image.image "350x100" crop="bottom" as im %}
<a href="{{ entry.get_absolute_url }}"><img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" alt=""></a>
{% endthumbnail %}
{% endif %}
이 그 일을하는 가장 좋은 방법이 될 수 없습니다 : 여기
는 지금 그것을 어떻게?
무슨 일이'{메신저 %로 % 썸네일 entry.main_image.image "350x100"작물 = entry.main_image.crop_value}'와됩니까? –
하하, 나는 crop = "entry.main_image.crop_value"시도했지만 그 ""와 함께 작동하지 않았다. 고맙습니다! –
답변으로 추가하겠습니다. –