To call the k2 item images on search page directly, please do try as following:
– Open “default_results.php” file in the folder “com_search\views\search\tmpl” and add custom code
$db = JFactory::getDBO();
$query = "
SELECT i.id,i.title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
CONCAT(i.introtext, i.fulltext) AS text,
CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug,
CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug
FROM #__k2_items AS i
INNER JOIN #__k2_categories AS c ON c.id=i.catid
WHERE i.id = ". $result->id;
$db->setQuery($query);
– Or please download my attach file and extract to your web root, it override “default_results.php” and “plugins/search/jak2_filter.php” files.
show_image_on_searchresultpage_2.zip