In this tutorial, we will learn how to display images in Joomla search results. To make it happen, you need to create a template override for your search results page. To learn how to do this, follow the steps below:
Log into your Joomla admin panel.
Locate Extensions dropdown in the top menu of your Joomla control panel and click on it.
Choose Templates => Templates from the list.
Find your active template in the list and click on it.
Locate Editor tab in the left section of the screen.
Choose HTML=>com_search menu item. If there is no com_search menu item in the list, proceed to the step 7.
Locate Create Overrides tab.
Locate Components column and choose com_search=>search. As a result, a template override page will be created.
Go back to the Editor tab.
Follow HTML=>com_search=>search=>default results direction. As a result, a page code appears in the right section of the screen.
Find the following string in the code:
<?php foreach ($this->results as $result) : ?>
<?php if (!empty($result->image)) { ?><div style="float: left;margin: 5px 10px;"><img src="/<?php echo $this->escape($result->image); ?>" alt="" /></div><?php } ?>
<?php endforeach; ?>
<?php if (!empty($result->image)) { ?><div style="clear:both"></div><?php } ?>
Go to the front-end to check the result.