Jump to content

Improvement to the thumbImage template

Go to solution Solved by Marc Stridgen,

Recommended Posts


The thumbImage template has two small issues IMHO that should be addressed.

{{if $image}}
	{{$image = ( $image instanceof \IPS\File ) ? (string) $image->url : $image;}}
	{{if $url}}<a {{if $dataParam}}{$dataParam} {{endif}}href='{$url}' title='{lang="$lang" sprintf="$name"}'{{else}}<span{{endif}} {{if !$lazyLoad || !settings.lazy_load_enabled}}style='background-image: url( "{file="$image" extension="$extension"}" )'{{else}}data-background-src='{file="$image" extension="$extension"}'{{endif}} class='{$classes} ipsThumb ipsThumb_{$size} ipsThumb_bg'>
		<img {{if $lazyLoad && settings.lazy_load_enabled}}src='{expression="\IPS\Text\Parser::blankImage()"}' data-{{endif}}src='{file="$image" extension="$extension"}' alt=''>
	{{if $url}}</a>{{else}}</span>{{endif}}
	{{if $url}}<a {{if $dataParam}}{$dataParam} {{endif}}href='{$url}' title='{lang="$lang" sprintf="$name"}'{{else}}<span{{endif}} class='{$classes} ipsNoThumb ipsThumb ipsThumb_{$size}'>{{if $url}}</a>{{else}}</span>{{endif}}

1. The lazy loading scheme used is outdated, as it could simply use the loading="lazy" parameter, as it has been updated in other templates.

2. The alt='' should be replaced with alt='{lang="$lang" sprintf="$name"}'


Link to comment
Share on other sites

  • 5 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...