Jump to content

How to display images in display template


Ilya Hoilik

Recommended Posts

Yes. By default it displays like this
2015-05-02_17-04-40_%D0%A0%D0%B0%D0%B1%D

If I select No formatting it displays like this

//website.eu/uploads/monthly_2015_04/40632989.jpg.6de8093c33870d665c9ca0d9b2ffb208.jpg,//website.eu/uploads/monthly_2015_04/37462013.jpg.509f5d739b214b7a2027cdad9c79e5d9.jpg,//website.eu/uploads/monthly_2015_04/30252449.jpg.51d9a871b29bd4e0674d349e9afa2a65.jpg,//website.eu/uploads/monthly_2015_04/37462030.jpg.b51e3678603ee186248399e071358e2d.jpg,//website.eu/uploads/monthly_2015_04/40549882.jpg.51beca6916179587ccbeba23ce9e06a9.jpg,//website.eu/uploads/monthly_2015_04/30265009.jpg.ef52ff0143717ab1cc1eba274811fc54.jpg,//website.eu/uploads/monthly_2015_04/15531406.jpg.d03be5d47ab792287f44b2871b99901a.jpg,//website.eu/uploads/monthly_2015_04/40554092.jpg.fb72f3374efee6df5436eeed2de2e27e.jpg

But how I can display just images without any default classes and size limits?

Link to comment
Share on other sites

This should work in the record template. Exchange the XXX with your field ID.  

{{if $record->field_XXX}}
      {{$fieldimage = explode(',',$record->field_XXX);}}
      {{foreach $fieldimage as $element}}
        <img class="yourclass" src="http:{$element})">
      {{endforeach}}
 {{endif}}   

 

Link to comment
Share on other sites

@Ralf H., thank you for help! I edited some lines in your code and it works!

{{if $record->customFieldDisplayByKey('FIELD-KEY', 'display')}}
    {{$fieldimage = explode(',',$record->customFieldDisplayByKey('FIELD-KEY', 'display'));}}
    {{foreach $fieldimage as $element}}
    	<img class="CUSTOM-CLASS" src="{$element}">
    {{endforeach}}
{{endif}} 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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