Results 1 to 9 of 9

Thread: Rss Ticker Ajax Str_replace Image Size

  1. #1
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rss Ticker Ajax Str_replace Image Size

    Dear Sirs

    I am trying to use rss ticker ajax code by dynamic drive.

    I need your helps about str_replace for images .
    For example one link's image width is 310px that I am trying to use as 100px.

    Could you please help me how I can change the sizes of images by str_replace command and how I can add following code.

    Code is as below and thanks advance your kind helps.

    Brgds
    armator
    +++

    CODE
    ------



    <?php

    /*
    ======================================================================
    LastRSS bridge script- By Dynamic Drive (http://www.dynamicdrive.com)
    Communicates between LastRSS.php to Advanced Ajax ticker script using Ajax. Returns RSS feed in XML format
    Created: Feb 9th, 2006. Updated: Feb 9th, 2006
    ======================================================================
    */

    header('Content-type: text/xml');

    // include lastRSS
    include "lastRSS.php"; //path to lastRSS.php on your server from this script ("bridge.php")

    // Create lastRSS object
    $rss = new lastRSS;
    $rss->cache_dir = 'cache'; //path to cache directory on your server from this script. Chmod 777!
    $rss->date_format = 'M d, Y g:i:s A'; //date format of RSS item. See PHP date() function for possible input.

    // List of RSS URLs
    $rsslist=array(
    "CNN" => ".xml",
    "BBC" => ".xml",
    "news.com" => ".xml",
    "slashdot" => ".xml",
    "dynamicdrive" => ".xml"
    );

    ////Beginners don't need to configure past here////////////////////

    $rssid=$_GET['id'];
    $rssurl=isset($rsslist[$rssid])? $rsslist[$rssid] : die("Error: Can't find requested RSS in list.");

    // -------------------------------------------------------------------
    // outputRSS_XML()- Outputs the "title", "link", "description", and "pubDate" elements of an RSS feed in XML format
    // -------------------------------------------------------------------

    function outputRSS_XML($url) {
    global $rss;
    $cacheseconds=(int) $_GET["cachetime"]; //typecast "cachetime" parameter as integer (0 or greater)
    $rss->cache_time = $cacheseconds;
    if ($rs = $rss->get($url)) {
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\">\n<channel>\n";
    foreach ($rs['items'] as $item) {
    echo "<item>\n<link>$item[link]</link>\n<title>$item[title]</title>\n<description>$item[description]</description>\n <pubDate>$item[pubDate]</pubDate> \n </item>\n\n";


    }
    echo "</channel></rss>";
    if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
    }
    else {
    echo "Sorry: It's not possible to reach RSS file $url\n<br />";
    // you will probably hide this message in a live version
    }
    }

    // ===============================================================================

    outputRSS_XML($rssurl);

    ?>

  2. #2
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Is Not There Any Body ?

    Is not there anybody for help ?

  3. #3
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rss Ticker Ajax Str_replace width HELP

    Dear Sirs

    I am waiting your helps.

    armator

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Use an image editing program to resize your image. That way it can display at the correct size with no dimension attributes and will not become distorted due to the resizing action (usually poor) of any given browser.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rss Ticker Ajax Str_replace width HELP

    Dear Friends

    I am waiting your kind help for my problem.

    And could you please show me the way as following command.

    var description='<div class="rssdescription">'+this.description[this.pointer].substr(0, 400)+'</div>'

    Is it possible to add above command that can image or image tag add instead of description.

    Awaiting yours as soon as possible.

    Brgds
    armator

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It depends upon where the information for the image is coming from. If it is coming from the feed, it would be required to find a way to extract that information in a usable form from the feed. If it is just an image on your server, you can do this:

    Code:
    var description='<div class="rssdescription"><img src="path/imagename.gif"></div>'
    Replace path/imagename.gif with the path and filename of your image. Best to use the absolute path to the image, ex:

    Code:
    http://www.yourdomain.com/images/some.gif
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rss Ticker Ajax Str_replace image size

    Dear John

    Thanks your kind help and interest for my problem.

    Kindly note I am getting datas by external server or from other breaking news web addresses the reason why I can not write static image names or numbers by your above command.

    You can check the images width = 310 height=210 by http://rss.internethaber.com/last_min.xml ( I am getting datas by this address)

    I am using now ticker ajax code as slide show but I have only one problem with images width and heights.

    Finaly I am thinking to change sizes from 310 to 110 and from 210 to 100.

    I hope that it will clarify for you to find solution for my problem.

    Thanks advance again your kind help.

    Best Regards
    Metin

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not clear on whether or not you've got the images showing up or, if so, where. You can change the image sizes to whatever you like using style in the head of your page:

    Code:
    <style type="text/css">
    .rssdescription img {
    width:210px;
    height:142px;
    }
    </style>
    That's assuming that the images are showing up inside the div with the class of rssdescription.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jun 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rss Ticker Ajax Str_replace image size

    Dear John

    Thanks again your kind interest and help about my problem.

    You style code is working very good.

    My best wishes.

    Metin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •