Back to PhocaGalleryImage class

Method getImageByImageId

public static
getImageByImageId
(mixed $id = 0)

Method getImageByImageId - Source code

public static function getImageByImageId($id = 0)
{
    $db = Factory::getDBO();
    $query = ' SELECT a.id, a.title, c.title as category_title' . ' FROM #__phocagallery AS a' . ' LEFT JOIN #__phocagallery_categories AS c ON c.id = a.catid' . ' WHERE a.id = ' . (int) $id . ' GROUP BY a.id, a.title, c.title' . ' ORDER BY a.id' . ' LIMIT 1';
    $db->setQuery($query);
    $image = $db->loadObject();
    return $image;
}