Jump to content

Card Layout: Custom image size for desktop and mobile


Daniel.de

Recommended Posts

Hi Alejandro,

I work on some customizations. I try to load different image sizes for desktop and mobile versions in the listing_card_layout_mytheme.thtml.

For the desktop version I use:

$mainMediaThumb = $Media->thumb(Sanitize::getVar($listing,'MainMedia'),['listing'=> &$listing,'size'=>'303x303','mode'=>'scale','return_url'=>true,'thumbnailer'=>'url']);

For Mobile:

$mainMediaThumb = $Media->thumb(Sanitize::getVar($listing,'MainMedia'),['listing'=> &$listing,'size'=>'160x160','mode'=>'scale','return_url'=>true,'thumbnailer'=>'url']);

JReviews is using 640x640. The images in the custom sizes will be loaded if I open the list view page and go to page 2 and back.

Is there a way to load it automatically?

This would be a nice feature, because I can use different image sizes for mobiles which will speed up the page.

Best Regards,

Daniel

Link to comment
×
×
  • Create New...