View Full Version : Rss Ticker Ajax Str_replace Image Size

07-10-2006, 08:22 AM
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.




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
"CNN" => ".xml",
"BBC" => ".xml",
"news.com" => ".xml",
"slashdot" => ".xml",
"dynamicdrive" => ".xml"

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

$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

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



07-12-2006, 06:37 AM
Is not there anybody for help ?

07-15-2006, 07:49 AM
Dear Sirs

I am waiting your helps.


07-15-2006, 07:53 PM
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.

07-17-2006, 01:20 PM
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.


07-17-2006, 05:00 PM
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:

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:


07-18-2006, 08:15 AM
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

07-18-2006, 08:39 AM
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:

<style type="text/css">
.rssdescription img {

That's assuming that the images are showing up inside the div with the class of rssdescription.

07-19-2006, 08:53 AM
Dear John

Thanks again your kind interest and help about my problem.

You style code is working very good.

My best wishes.