Reply
Old May 9th, 2005 Top | #21
 
ZenithalRavage's Avatar
OSNN Junior Addict
Joined: May 2005
Location: The Netherlands
Posts: 6
Reputation: 0
Power: 86

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

Originally Posted by Geffy
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

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.



"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
ZenithalRavage is offline   Reply With Quote
Old August 12th, 2005 Top | #22

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Originally Posted by NetRyder
I was initially using the FeedBurner headline animator which is really easy to setup and use.
http://www.feedburner.com/fb/a/about...D5998ADC0.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?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old August 12th, 2005 Top | #23
 
LordOfLA's Avatar
Godlike!
Joined: February 2004
Location: Salisbury, Wiltshire, UK
Posts: 7,031
Blog Entries: 5
Reputation: 4137
Power: 213

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

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>';
	}

?>



If HK-47 and GLaDOS had a child, the character they create would cause the video game world to overdose on awesome. -sheridanmovieguy: Dragon age forum user.
LordOfLA is offline   Reply With Quote
Old August 12th, 2005 Top | #24

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Originally Posted by LordOfLA
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?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old August 12th, 2005 Top | #25
 
LordOfLA's Avatar
Godlike!
Joined: February 2004
Location: Salisbury, Wiltshire, UK
Posts: 7,031
Blog Entries: 5
Reputation: 4137
Power: 213

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

Originally Posted by kcnychief
Am I psycho?
Yes but thats a side effect of OSNN



If HK-47 and GLaDOS had a child, the character they create would cause the video game world to overdose on awesome. -sheridanmovieguy: Dragon age forum user.
LordOfLA is offline   Reply With Quote
Old August 12th, 2005 Top | #26

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Originally Posted by LordOfLA
Yes but thats a side effect of OSNN
lol....

Any tips on where I'd get started?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old August 12th, 2005 Top | #27
 
LordOfLA's Avatar
Godlike!
Joined: February 2004
Location: Salisbury, Wiltshire, UK
Posts: 7,031
Blog Entries: 5
Reputation: 4137
Power: 213

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

www.php.net
www.mysql.org



If HK-47 and GLaDOS had a child, the character they create would cause the video game world to overdose on awesome. -sheridanmovieguy: Dragon age forum user.
LordOfLA is offline   Reply With Quote
Old August 16th, 2005 Top | #28

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

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?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old August 16th, 2005 Top | #29

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Feedburner is working good enough for what I need, thanks to all for their attempted help, and sorry for the dumb questions

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 3rd, 2006 Top | #30

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Shouldn't this be the only section I have to modify:

Code:
// variable definitions 
// Image Vars 
$image = "banner_468x60_var1_back.jpg";        // image dimensions 468x60px 
$font  = "verdana.ttf"; 
$size  = 7; 
$horiz = 185; 
$vert  = 16; 
$maxlen= 60; 
 
// RDF Parsing Vars 
$url   = "http://www.osnn.net/modules.php?modname=backend&action=rdf"; 
$temp  = "temp.xml"; 
$store = 0; 
$count = 0; 
$maxent= 4; 
$array = array(); 
I would think if I change the "$image" and "$url", that should be all I need to change?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 3rd, 2006 Top | #31

OSNN Folding Team  
Grandmaster's Avatar
Electronica Addict
Joined: February 2002
Location: Santa Clara, CA
Posts: 10,574
Reputation: 2960
Power: 260

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

Seems like it.


Grandmaster is offline   Reply With Quote
Old March 3rd, 2006 Top | #32

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

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   = "http://djrcs.com/blog/?feed=rss2"; 
$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); 
?>

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 3rd, 2006 Top | #33

OSNN Folding Team  
Geffy's Avatar
OSNN Veteran Addict
Joined: March 2002
Location: United Kingdom
Posts: 7,805
Reputation: 1490
Power: 217

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

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)


blogtumbloglastfmflickr#rubyonrails@twitter
"I could be replaced with a very small shell script"
Geffy is offline   Reply With Quote
Old March 3rd, 2006 Top | #34

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Originally Posted by Geffy
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?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 3rd, 2006 Top | #35

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

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 ?

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 3rd, 2006 Top | #36

OSNN Folding Team  
Geffy's Avatar
OSNN Veteran Addict
Joined: March 2002
Location: United Kingdom
Posts: 7,805
Reputation: 1490
Power: 217

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

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


blogtumbloglastfmflickr#rubyonrails@twitter
"I could be replaced with a very small shell script"
Geffy is offline   Reply With Quote
Old March 3rd, 2006 Top | #37
 
melon's Avatar
MS-DOS 2.0
Joined: February 2002
Location: Ásgarðr
Posts: 854
Reputation: 420
Power: 138

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

Yes, look at your permissions first. If that doesn't work, perhaps try an absolute path for the font file?

Melon
melon is offline   Reply With Quote
Old March 4th, 2006 Top | #38

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

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.

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 6th, 2006 Top | #39

OSNN Folding Team  
kcnychief's Avatar
█▄█ ▀█▄ █
Joined: April 2005
Location: Massachusetts
Posts: 16,949
Reputation: 4941
Power: 305

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

Changed permissions, now I get this

Code:
Internal Server Error

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.

XBOX Live Gamertag: kcnychief
kcnychief is offline   Reply With Quote
Old March 7th, 2006 Top | #40

OSNN Folding Team  
Geffy's Avatar
OSNN Veteran Addict
Joined: March 2002
Location: United Kingdom
Posts: 7,805
Reputation: 1490
Power: 217

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

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.


blogtumbloglastfmflickr#rubyonrails@twitter
"I could be replaced with a very small shell script"
Geffy is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
Signature image in Pictures help? zapoqx Graphic Design 5 December 21st, 2006 5:49am
Best RSS Feed Bman Green Room 14 September 12th, 2006 11:57pm
how do i add a rss feed to the feed viewer in vista VenomXt Windows Desktop Systems 1 June 15th, 2006 10:44pm
RSS Feed sean.ferguson Green Room 1 October 16th, 2004 10:02am
RSS feed for NTFS? Leo154 Web Design & Coding 13 May 21st, 2003 6:44pm