angrybeanie_wagtail/env/lib/python3.12/site-packages/wagtail/images/components.py

12 lines
376 B
Python
Raw Normal View History

2025-07-25 21:32:16 +10:00
from wagtail.admin.ui.fields import BaseFieldDisplay
from wagtail.images.shortcuts import get_rendition_or_not_found
class ImageDisplay(BaseFieldDisplay):
rendition_spec = "max-400x400"
def render_html(self, parent_context):
if self.value is None:
return None
return get_rendition_or_not_found(self.value, self.rendition_spec).img_tag()