Thursday, March 10, 2016

Joomla 3 - Get article intro Image by article Id


Here the following post is useful to get article images from the article id in joomla3.

$article_id = JFactory::getApplication()->input->get('id'); // get article id

$article = JTable::getInstance("content");
$article->load(JRequest::getInt("id")); // Get Article ID
$article_images = $article->get("images"); // Get image parameters
$pictures = json_decode($article_images); // Split the parameters apart

// Print the image
echo "<img src='" . $pictures->image_intro . "' alt='" . $pictures->image_intro_alt . "'>";

Good Luck!! Cheers :)

No comments:

Post a Comment