Skip to content

Commit

Permalink
update tips with thumbnail creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nworr committed May 21, 2024
1 parent 2292705 commit 7a4c5f8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/publish/lizmap_plugin/attribute_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,16 @@ in a new browser tab.

If the media points to an image (a JPG or PNG file), you could add new column showing
a small image preview of the source image by adding a new **virtual field** in your vector layer,
with this **expression**. In the example below, the field containing the media path is ``media_path``
with this **expression** (which create an image with a data attribute containing the image path and a CSS class ``data-attr-thumbnail``). In the example below, the field containing the media path is ``media_path``
and the virtual field is named ``vignette``:


.. code-block::
concat(
'<img data-src="',
'<img class="data-attr-thumbnail" data-src="',
"media_path" ,
'" src="/themes/default/css/img/logo_footer.png" style="height:60px;"
onload="this.src = `${lizUrls.media}?repository=${lizUrls.params.repository}&project=${lizUrls.params.project}&path=${this.getAttribute(\'data-src\')}`;">'
'" src="/themes/default/css/img/logo_footer.png" style="height:60px;">'
)
The result will look like:
Expand Down

0 comments on commit 7a4c5f8

Please sign in to comment.