-
AuthorPosts
-
May 12, 2014 at 4:58 pm #197681
How to make mod_janews_featured use the first image of article in frontpage?.
I use Joomla 3.xNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
May 13, 2014 at 9:45 am #534840The function to get images from articles of your site comes from the jaimage.php files in mod_jabulletin, mod_janews_featured and mod_janewspro modules.
Please make to change these jaimage.php files in
modules/mod_jabulletin/jaimage.php
modules/mod_janews_featured/helpers/jaimage.php
modules/mod_janewspro/helpers/jaimage.phpChange
function parseImage($row)
{
//check to see if there is an intro image or fulltext image first
$images = "";
if (isset($row->images)) {
$images = json_decode($row->images);
}
if((isset($images->image_fulltext) and !empty($images->image_fulltext)) || (isset($images->image_intro) and !empty($images->image_intro))){
$image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:((isset($images->image_fulltext) and !empty($images->image_fulltext))?$images->image_fulltext:"");
}
else {
$regex = '/<img.+srcs*=s*"([^"]*)"[^>]*>/';
$text = '';
$text .= (isset($row->fulltext))?$row->fulltext:'';
$text .= (isset($row->introtext))?$row->introtext:'';
preg_match($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
$image = count($images) > 1 ? $images[1] : '';
}
return $image;
}
To
function parseImage($row)
{
//check to see if there is an intro image or fulltext image first
$images = "";
if (isset($row->images)) {
$images = json_decode($row->images);
}
if((isset($images->image_fulltext) and !empty($images->image_fulltext)) || (isset($images->image_intro) and !empty($images->image_intro))){
$image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:((isset($images->image_fulltext) and !empty($images->image_fulltext))?$images->image_fulltext:"");
}
else {
$regex = '/<img.+srcs*=s*"([^"]*)"[^>]*>/';
$text = '';
$text .= (isset($row->fulltext))?$row->introtext:'';
$text .= (isset($row->introtext))?$row->fulltext:'';
preg_match($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
$image = count($images) > 1 ? $images[1] : '';
}
return $image;
}
Once done, clear cache from admin area, let me know if it helps.
May 13, 2014 at 2:55 pm #534882It worked!,
Nija Lead, thank you very much. -
AuthorPosts
This topic contains 3 replies, has 2 voices, and was last updated by juancabezas 10 years, 7 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum