test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • juancabezas Friend
    #197681

    How to make mod_janews_featured use the first image of article in frontpage?.
    I use Joomla 3.x

    Ninja Lead Moderator
    #534840

    The 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.php

    Change


    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.

    juancabezas Friend
    #534882

    It worked!,
    Nija Lead, thank you very much.

Viewing 3 posts - 1 through 3 (of 3 total)

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