[RSS+PHP(?)]RSS Feed in Signature Image...

Geffy said:
it should work in IE, make sure you completely refresh your cache.

the imagettftext thing would probably be caused by your host not having FreeType2 support in the GD extension for PHP.
phew, Imagettftext works now! I got a reply from my webhost and all I had to do was put ./ infront of the fontname, so instead of:

$font = "arial.ttf";

this:

$font = "./arial.ttf";

sheesh :dead:

So if someone has similar problems and the host does not allow the GDFONTPATH command, this could be your solution ;) (font still in the same path as the .php file)

Oh and IE seems to like the imagettftext version better than the imagestring one too.
 
NetRyder said:
I was initially using the FeedBurner headline animator which is really easy to setup and use.
http://www.feedburner.com/fb/a/aboutgiffy;jsessionid=3ACFB6DD66605FBAC3774F3D5998ADC0.app3

The new set that you see, I coded from scratch, mainly as a learning experience. Plus I could customize it the way I wanted. If you've used the GD library before with PHP, it shouldn't be that hard to do. Parse the XML file to pull out only the post titles and stick them onto the image using imagettftext()

I'm sure there are ready scripts somewhere out there, but I'd suggest trying it on your own first. It's more fun that way. Look up some GD tutorials for reference. I can also help you along the way if you need anything. :)

Since my coding skills are non-existing, I'm going to try feedburner for now...

EDIT: I have HTML code for my sig, can I convert this somehow into a language I can display?
 
Not sure if you're interested at all folks but PHP5 hs the SimpleXML module which means you can churn out an RSS parser in the following code:

Code:
<?
	// SimpleXML parser for FreeBSD SA RSS Feed

	$xml = simplexml_load_file('http://www.freebsd.org/security/advisories.rdf');
	
	foreach ($xml->item as $item)
	{
		echo '<li><a class="advlink" href="' . $item->link .'">' . $item->title .'</a></li>';
	}

?>
 
LordOfLA said:
Not sure if you're interested at all folks but PHP5 hs the SimpleXML module which means you can churn out an RSS parser in the following code:

Code:
<?
    // SimpleXML parser for FreeBSD SA RSS Feed
 
    $xml = simplexml_load_file('http://www.freebsd.org/security/advisories.rdf');
 
    foreach ($xml->item as $item)
    {
        echo '<li><a class="advlink" href="' . $item->link .'">' . $item->title .'</a></li>';
    }
 
?>

lol, i'm so clueless :)

I have another question. I'm going to setup a forum, which I want to RSS to the main page of my blog, and then from the blog RSS to my sig here :)

Am I psycho?
 
Hey NetRyder,

When you used Feedburner, do you know how long it takes to update between the blog and the actual image?

What I did, was I created the Feedburner image, copied the HTML into frontpage, and then on the "design" tab, I copied and pasted the actual picture into my sig. Will this work?
 
Feedburner is working good enough for what I need, thanks to all for their attempted help, and sorry for the dumb questions :)
 
Shouldn't this be the only section I have to modify:

Code:
[COLOR=#ff8000]// variable definitions 
// Image Vars 
[/COLOR][COLOR=#0000bb]$image [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"banner_468x60_var1_back.jpg"[/COLOR][COLOR=#007700];        [/COLOR][COLOR=#ff8000]// image dimensions 468x60px 
[/COLOR][COLOR=#0000bb]$font  [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"verdana.ttf"[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$size  [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]7[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$horiz [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]185[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$vert  [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]16[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$maxlen[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]60[/COLOR][COLOR=#007700]; 
 
[/COLOR][COLOR=#ff8000]// RDF Parsing Vars 
[/COLOR][COLOR=#0000bb]$url   [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"http://www.osnn.net/modules.php?modname=backend&action=rdf"[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$temp  [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"temp.xml"[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$store [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]0[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$count [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]0[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$maxent[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]4[/COLOR][COLOR=#007700]; 
[/COLOR][COLOR=#0000bb]$array [/COLOR][COLOR=#007700]= array(); [/COLOR]

I would think if I change the "$image" and "$url", that should be all I need to change?
 
Not working for me though :(

EDIT: Look at this:

http://www.djrcs.com/sig/sig.php

EDIT 2: Here is my full code, for reference:

Code:
<?php 
// variable definitions 
// Image Vars 
$image = "sig.jpg";        // image dimensions 301x100px 
$font  = "verdana.ttf"; 
$size  = 7; 
$horiz = 185; 
$vert  = 16; 
$maxlen= 60; 
// RDF Parsing Vars 
$url   = "[URL="http://djrcs.com/blog/?feed=rss2"]http://djrcs.com/blog/?feed=rss2[/URL]"; 
$temp  = "temp.xml"; 
$store = 0; 
$count = 0; 
$maxent= 4; 
$array = array(); 
// XML parsing functions 
function openTag($parser, $name, $attrs) { 
    global $store; 
      
    if ($name == "TITLE") { 
        $store = 1; 
    } else { 
        $store = 0; 
    } 
} 
function closeTag($parser, $name) { 
    // w00p de doo 
} 
function charData($parser, $data) { 
    global $store, $array; 
    if ($store == 1 && $count <= $maxent) { 
        $array[] = $data; 
        $store = 0; 
        $count++; 
    } 
} 
function storeXML($filename, $string) { 
    $string = ereg_replace('&amp;', 'and', $string); 
    $string = ereg_replace('&', 'and', $string); 
    $fp = fopen($filename, "w") or die ("unable to open storage file for writing<br />\nif it exists then chmod {$filename} to 666"); 
    $write = fwrite($fp, $string); 
    fclose($fp); 
    return $write; 
} 
// define the parser 
$parser = xml_parser_create(); 
xml_set_element_handler($parser, "openTag", "closeTag"); 
xml_set_character_data_handler($parser, "charData"); 
if (!(storeXML($temp, file_get_contents($url)))) { 
    die ("Unable to store OSNN RDF Data"); 
} 
if (!($handle = fopen($temp, "r"))) { 
    die ("Unable to open Temp store<br />\nif it exists then chmod {$temp} to 666"); 
} 

while ($data = fread($handle, filesize($temp))) { 
    if (!xml_parse($parser, $data, feof($handle))) { 
        die (xml_error_string(xml_get_error_code($parser))); 
    } 
} 
xml_parser_free($parser); 
// make sure no strings are too long 
foreach ($array as $key => $value) { 
    if (strlen($value) > $maxlen) { 
        $array[$key] = substr($value, 0, 45) . ".."; 
    } 
} 
reset($array); 
// Image Creation 
$imgData = getimagesize($image); 
if ($imgData[2] == 1) { 
    header("Content-type: image/gif"); 
    $im = ImageCreateFromGIF($image); 
} else { 
    header("Content-type: image/jpeg"); 
    $im = ImageCreateFromJPEG($image); 
} 
$textc = ImageColorAllocate($im,64,89,132); 
$black = ImageColorAllocate($im,0,0,0); 
ImageTTFText($im,$size,0,$horiz,$vert,$textc,$font,$array[1]); 
ImageTTFText($im,$size,0,$horiz,$vert+12,$textc,$font,$array[2]); 
ImageTTFText($im,$size,0,$horiz,$vert+24,$textc,$font,$array[3]); 
ImageTTFText($im,$size,0,$horiz,$vert+36,$textc,$font,$array[4]); 
if ($imgData[2] == 1) { 
    ImageGIF($im); 
} else { 
    ImageJPEG($im,'',100); 
} 
ImageDestroy($im); 
?>
 
You need to have a copy of the Verdana true type font file in the same directory

you also need to have the directory writable by all or else create the temp.xml file and make that writable by your webserver (or all)
 
Geffy said:
You need to have a copy of the Verdana true type font file in the same directory

you also need to have the directory writable by all or else create the temp.xml file and make that writable by your webserver (or all)

Thanks for the tips, would the second part be a chmod 677?
 
Have changed the permissions and added the font, still no worky. Here's my error log:

Code:
[02-Mar-2006 22:00:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:00:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:00:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:00:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[02-Mar-2006 22:06:49] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:06:49] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:06:49] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:06:49] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[02-Mar-2006 22:06:52] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:06:52] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:06:52] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:06:52] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[02-Mar-2006 22:06:54] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:06:54] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:06:54] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:06:54] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[02-Mar-2006 22:06:58] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:06:58] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:06:58] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:06:58] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[02-Mar-2006 22:08:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[02-Mar-2006 22:08:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[02-Mar-2006 22:08:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[02-Mar-2006 22:08:48] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[03-Mar-2006 05:00:21] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[03-Mar-2006 05:00:21] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[03-Mar-2006 05:00:21] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[03-Mar-2006 05:00:21] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99
[03-Mar-2006 07:09:28] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 96
[03-Mar-2006 07:09:28] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 97
[03-Mar-2006 07:09:28] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 98
[03-Mar-2006 07:09:28] PHP Warning:  imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in /home/djrcs/public_html/sig/sig.php on line 99

EDIT: Here is the section it refers to:

Code:
} 
 
function storeXML($filename, $string) { 
    $string = ereg_replace('&amp;', 'and', $string); 
    $string = ereg_replace('&', 'and', $string); 
    $fp = fopen($filename, "w") or die ("unable to open storage file for writing<br />\nif it exists then chmod {$filename} to 666"); 
    $write = fwrite($fp, $string); 
    fclose($fp); 
    return $write; 
}

Kinda weird, but the font verdana.ttf is there ?
 
Is the font file chmod 644 at least? The webserver will need to be able to at least read it. Additionally for that section which you list the temp.xml file will need to be chmod 666 so that its readable and writable by the webserver
 
Yes, look at your permissions first. If that doesn't work, perhaps try an absolute path for the font file?

Melon
 
I had altered the permissions for the entire directory, but in the tree above. I was actually thinking while driving to work I may need to check the perms on each file. Will do tomorrow when I'm home again and update the thread, thx guys.
 
Changed permissions, now I get this :(

Code:
[B]Internal Server Error[/B]

The server encountered an internal error or misconfiguration and was unable to complete your request. 
Please contact the server administrator, webmaster@djrcs.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. 
More information about this error may be available in the server error log. 
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
 
the php file should not cause an internal server error really, check you error log to see what apache thinks is wrong. Also you might want to check the status of your error documents, its looks like your error500 file isn't setup properly.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back