[mod] typification of SearXNG: add new result type Image (#6142)

- Python class:   searx/result_types/image.py
- Jinja template: searx/templates/simple/result_templates/images.html
- CSS (less)      client/simple/src/less/result_types/image.less

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser
2026-05-25 17:49:56 +02:00
committed by Markus Heiser
parent 28ef4f7447
commit c629dd4f3c
8 changed files with 59 additions and 49 deletions
+2
View File
@@ -35,6 +35,7 @@ from .keyvalue import KeyValue
from .code import Code
from .paper import Paper
from .file import File
from .image import Image
class ResultList(list[Result | LegacyResult], abc.ABC):
@@ -50,6 +51,7 @@ class ResultList(list[Result | LegacyResult], abc.ABC):
Code = Code
Paper = Paper
File = File
Image = Image
MainResult = MainResult
Result = Result
Translations = Translations
+44
View File
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Typification of the *image* results. Results of this type are rendered in
the :origin:`images.html <searx/templates/simple/result_templates/images.html>`
template.
.. autoclass:: Image
:members:
:show-inheritance:
"""
__all__ = ["Image"]
import typing as t
from ._base import MainResult
@t.final
class Image(MainResult, kw_only=True):
"""Result type suitable for displaying images.
The images are displayed as small thumbnails in the main results list.
Clicking on the preview opens a gallery view in which all further metadata
for the image is displayed."""
template: str = "images.html"
thumbnail_src: str = ""
"""URL of a preview of the image."""
resolution: str = ""
"""The resolution of the image (e.g. ``1920 x 1080`` pixel)"""
img_format: str = ""
"""The format of the image (e.g. ``png``)."""
source: str = ""
"""Source of the image."""
filesize: str = ""
"""Size of bytes in :py:obj:`human readable <searx.humanize_bytes>` notation
(e.g. ``1MB`` for ``1024*1024`` Bytes filesize)."""