{{tpl:EntryFirstImage}}

The tag {{tpl:EntryFirstImage}} shows only the first image of an entry and it's used in the template tag <tpl:Entries>. If there is no image found, this tag can show the first image of the description for the category belonging to an entry. (see also with_category ci-dessous).

Note:

Only images in the media organizer can be used for this tag.

Attribute

size

The attribute size allows to display an image accurate to its size. It accepts five values 1) :

  • sq format square (48×48 pixels)
  • t format miniature (100 pixels)
  • s small format (240 pixels)
  • m format middle (448 pixels)
  • o format original

By default, an image is displayed in small format.

class

The attribute class adds the class CSS to an image, that allows you to personalize its style in your style.css.

with_category

By default, if there is no image found in your entry, there is no image shown. If you want to force showing an image by default, however, there is no image to a particular entry, you can choose the option with_category="1". In this case, if an entry doesn't contain any image, the image will be that of your category according to your category description.

no_tag

By default, image is displayed within an img tag. If you wish to retrieve only its URL, you may use the option no_tag = "1".

content_only

By default, the image is retrieved from the post's abstract and content. If you wish to extract the image from the content only, use the option content_only = "1".

cat_only

By default, the image is retrieved from current post. If you wish to extract the image from post's category description, use the option cat_only = "1".

Example

<tpl:Entries>
  {{tpl:EntryFirstImage size="sq" class="left" with_category="1"}}
  <h2>{{tpl:EntryTitle encode_html="1"}}</h2>
  <br style="clear:both;" />
</tpl:Entries>

This code shows a list of entries with an image in format miniature on the left side if the title. If this entry doesn't have an image, the first image of your category will be shown (if it exists).

1) The maximal dimensions are supplied by title identification. This can be ajustées in the blog's parameter.

Wiki powered by Dokuwiki.