Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • ericl1 Friend
    #181575

    Hi

    Please help with the JA News Featured, I have two (2) images in the same article. The first image is placed after the Read more, and the Second image is after the Read more. The first image is the primary photo and should appear in the Ja News Featured Module at the front-end

    And when i click the “Save” button and make it “Featured, the second image which is after the Read more is the one whose appearing in the front-end instead of the first image which is placed before the Read more.

    JA News Featured: version 2.5.1

    I really don’t know how to do it,
    If ever one of the Developers of JA is right there, Please help me

    Manos Moderator
    #470630

    Hi,

    I tried to see the problem and help you but i couldn’t identify the problem, is this solved or is there a way i can see the problem?

    Regards

    ericl1 Friend
    #470634

    Thank you for your immediate reply.

    Here is the sample article, as you can see at the top left(First image) of the article that is the image i really wanted to appear at the front-end of my website. And the Second image is also related to an article.

    After clicking the “Save” button so that it will appear on my front end and my visitors will be able to read the newly article, Here is the output when you View your front-end

    As you can see the Second image is the one who appear on the front-end

    Please help me regarding this


    1. error
    2. error1
    Stork11 Friend
    #470980

    <em>@ericl1 343067 wrote:</em><blockquote>Thank you for your immediate reply.

    Here is the sample article, as you can see at the top left(First image) of the article that is the image i really wanted to appear at the front-end of my website. And the Second image is also related to an article.

    After clicking the “Save” button so that it will appear on my front end and my visitors will be able to read the newly article, Here is the output when you View your front-end

    As you can see the Second image is the one who appear on the front-end

    Please help me regarding this</blockquote>
    Hello ericl1,

    I have checked and could not see any issue as reported.

    BTW, please try to check “Images and links” setting of Article settings.

    Regards.

    dieudonne Friend
    #484149

    Hello,

    we have the same problem on the right.

    Like Ericl1, we have 2 images, and sometime, this is the second image who appears on this module.

    How can we fix this ?

    Thank in advance
    We use Joomla 2.5 and all plugins, modules, …are up to date.


    1. 2013-02-21_11h13_45
    2. 2013-02-21_11h14_39
    dieudonne Friend
    #484498

    update : this problem appears also in JA TAbs


    1. 2013-02-25_23h36_03
    Stork11 Friend
    #484510

    Hello dieudonne,

    Please PM me (or update in your ticket) with your site information (your site URL, your site admin account) and your FTP account So I can diagnose this problem. Because I tested many times on my local but no problem faced.

    Regards.

    Stork11 Friend
    #484593

    The problem was fixed. Pleaes check and confirm the same.

    I fixed in “/modules/mod_jabulletin/jaimage.php” file to get image in intro text first.

    Regards.

    Stork11 Friend
    #484655

    Hello all,

    Problem occurred because image in full text was parsed first. So I moved “$text .= (isset($row->introtext))?$row->introtext:”;” line to below “$text .= (isset($row->fulltext))?$row->fulltext:”;” line. Image in intro text must be parsed first.

    Make the same change for JA News Pro and JA News Featured as well.

    Regards.

    dieudonne Friend
    #485158

    Thank you very much for this.

    dpchap015 Friend
    #503295

    @stork11
    <em>@Stork11 361955 wrote:</em><blockquote>Hello all,

    Problem occurred because image in full text was parsed first. So I moved “$text .= (isset($row->introtext))?$row->introtext:”;” line to below “$text .= (isset($row->fulltext))?$row->fulltext:”;” line. Image in intro text must be parsed first.

    Make the same change for JA News Pro and JA News Featured as well.

    Regards.</blockquote>

    Original Code:
    [PHP]
    $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] : ”;
    [/PHP]

    I interchanged the lines = > $text .= (isset($row->fulltext))?$row->fulltext:”; & $text .= (isset($row->introtext))?$row->introtext:”;

    This is how my code looks like now:
    [PHP] 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->introtext))?$row->introtext:”;
    $text .= (isset($row->fulltext))?$row->fulltext:”;
    preg_match($regex, $text, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = count($images) > 1 ? $images[1] : ”;
    }
    return $image;
    }
    }
    }[/PHP]

    I don’t fix my issue, Still the system picks 2nd image of the article to show in the JA News Featured Module.

    I feel there is some problem with the code:
    [PHP]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:””);
    }[/PHP]

    Ninja Lead Moderator
    #503301

    This way will help you to get only image in introtext


    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_intro) and !empty($images->image_intro)){
    $image = (isset($images->image_intro) and !empty($images->image_intro))?$images->image_intro:"";
    }
    else {
    $regex = '/<img.+srcs*=s*"([^"]*)"[^>]*>/';
    $text = '';
    $text .= (isset($row->introtext))?$row->introtext:'';
    preg_match($regex, $text, $matches);
    $images = (count($matches)) ? $matches : array();
    $image = count($images) > 1 ? $images[1] : '';
    }
    return $image;
    }

    But you also need to change all jaimage.php files in JA Newsfeatured, JA Newspro, JA Sidenews, JA Contentslider, JA Bulletin module. Because JAImage class in jaimage.php file of all these modules is loaded once only.

    Remember to clear cache from Admin area.

    dpchap015 Friend
    #503316

    @ninja Lead
    I am unable to understand as to why i am getting this error : Parse error: syntax error, unexpected ‘{‘ in /home/eduvativ/public_html/test/etr_test_2/modules/mod_janews_featured/helpers/jaimage.php on line 399
    on copying your code to the file. I have just replaced the code.

    dpchap015 Friend
    #503317

    I think i found the problem. An extra ‘(‘ in if((isset($images->image_intro) and !empty($images->image_intro)).

    I guess its working now. Will update after testing it properly. 😉

    Ninja Lead Moderator
    #503349

    That’s great, excellent

Viewing 15 posts - 1 through 15 (of 19 total)

This topic contains 19 replies, has 8 voices, and was last updated by  Ninja Lead 10 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum