Jump to content

Improvement to the thumbImage template


Go to solution Solved by Marc,

Recommended Posts

Hi,

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}}
{{else}}
	{{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}}
{{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"}'

Cheers!

Link to comment
Share on other sites

Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.

 

Link to comment
Share on other sites

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

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