• 0

RSS Feed Based Signature


Question

At the moment, in my signature I have the news from my blog, powered by Feedburner. I like how it works, but I think it is a bit too ugly and cumbersome to look nice in a signature. So, I've had an idea that someone might be able to do for me, or even make a site that will do it automatically:

So my feed URL is:

http://www.tim-rogers.co.uk/cutenews/rss.php

and I want to create a signature that shows the title of the latest post made on the blog. If the title is over a certain chracter limit, the ending wil be cut off and replaced with "..."

Here is the template I have created

trbfeedsigsample2tq.png

Can anyone do this?

Link to comment
https://www.neowin.net/forum/topic/348102-rss-feed-based-signature/
Share on other sites

18 answers to this question

Recommended Posts

  • 0

So you just want the one title, no animation?

If you have GD installed on your server, its relatively easy.

(I will write something that should work in PHP for you and reply. - I can do it faster in ASP.net and some other languages but it looks like your running PHP).

I haven't written PHP for a while and don't have it installed, so it MAY work, but i'm pretty sure that i can get something thats close to working at least, or gives the general idea of how you'd do it.

  • 0

Yah, im in the middle of writing it. I can't test it though, because i don't have PHP installed.

To test for gd i think you just have to make a new page with this:

<?php
php_info():
?>

It should list gd somewhere on it "i think there is a section where it lists php component configurations"

  • 0

Heres how you get the title from your feed: (you can also use xml functions for this)

$feedurl = "http://www.tim-rogers.co.uk/cutenews/rss.php"; //can also be local url
$fp = fopen(,"r"); //open the feed
$contents = fread($fp,filesize($feedurl));
fclose($fp);

preg_match("<item>\s*<title>\s*(.*?)\s*</title></item>",$contents,$matchdata); //matches a regular expression for the title
$title = $matchdata[1];

Oh yah, i realized that the code is different for GD2 and plain old GD. So try to find out which one your running.

Also tell me if there are any problems with this code. Try printing $title after it.

  • 0

Well the idea is to take the background image and just throw the text on top.

I can do this for you.

I guess i probably should install php on my computer anyways because its useful and just write the whole thing and attach it, but i would still need to know what version of gd you have.

To find this out:

1. Download attached file

2. Rename it as phpinfo.php

3. Upload it to your server

4. Run it to find out your gd version or send the url to me.

php_info.txt

  • 0

Heres my little script: (also attached as .txt file, rename as .php>

There are a number of variables that are editable, mentioned at the top.

<? 
// editable:
// $feedurl - the url of your feed
// $imageurl - your background image (if not png change imagecreatefrompng to imagecreatefromgif or other types)
// $fontcolor - the font color
// $fontsize - the font size
// $font - the ttf font file path ex: 'arial.ttf'
// $x - the x position of text
// $y - the y position of text
// $angle - text angle

$feedurl = "http://www.tim-rogers.co.uk/cutenews/rss.php";

$fp = fopen($feedurl,"r");
$contents = ".";
while (!feof($fp))
	$contents .= fread($fp,8192);
fclose($fp);

preg_match("#<rss.*?>.*?<channel.*?<item>\s*<title>\s*(.*?)\s*<\/title>#s",$contents,$matchdata);
$title = $matchdata[1];

$imageurl = "http://img348.imageshack.us/img348/7508/trbfeedsigsample2tq.png";

$img = imagecreatefrompng($imageurl);

$font = 'arial.ttf';
$fontcolor = imagecolorallocate($img, 255, 255, 255);
$fontsize = 8;
$x = 65;
$y = 16;
$angle = 0;

imagettftext($img,$fontsize,$angle,$x,$y,$fontcolor,$font,$title);

header('Content-type: image/png');
imagepng($img);
?>

rss.txt

  • 0

Nice job benjeeeboy, can I use it too?

Edit: Can't get it working. :/ Here's my code:

<? 
// editable:
// $feedurl - the url of your feed
// $imageurl - your background image (if not png change imagecreatefrompng to imagecreatefromgif or other types)
// $fontcolor - the font color
// $fontsize - the font size
// $font - the ttf font file path ex: 'arial.ttf'
// $x - the x position of text
// $y - the y position of text
// $angle - text angle

$feedurl = "http://blog.mynimal.net/?feed=rss2";

$fp = fopen($feedurl,"r");
$contents = ".";
while (!feof($fp))
	$contents .= fread($fp,8192);
fclose($fp);

preg_match("#<rss.*?>.*?<channel.*?<item>\s*<title>\s*(.*?)\s*<\/title>#s",$contents,$matchdata);
$title = $matchdata[1];

$imageurl = "http://www.mynimal.net/feed.png";

$img = imagecreatefrompng($imageurl);

$font = 'arial.ttf';
$fontcolor = imagecolorallocate($img, 255, 255, 255);
$fontsize = 8;
$x = 65;
$y = 16;
$angle = 0;

imagettftext($img,$fontsize,$angle,$x,$y,$fontcolor,$font,$title);

header('Content-type: image/png');
imagepng($img);
?>

Using Wordpress, all the files are there. Here's the URL:

http://www.mynimal.net/feed.php

Edited by mynimal
  • 0

I prefer asp.net as a development language. Image output is much easier in it. If you would like, I could work up a signature using that. I do most of my development now on ASP.NET 2.0 but as its still in beta, 1.1 is probably better for something that will be deployed by other people.

I think i'll take a stab at it tommarow.

Edited by benjeeeboy
  • 0

mynimal, feel free to use it.

The reason your feed didn't show was that for whatever reason, your image didn't fit valid php spec (right clicking on it in firefox shows this too under alt).

I opened the image in PS and resaved it and it worked. Try the attached version

post-23893-1122173608.png

  • 0

That looks really good.

I just realized though that if the title in the feed is greater than a certain length (in pixels), it will just run off the edge of the image, while it really should do a ... thing at the end.

I also thought of a few extra options that may be good to add. I will probably post another soon, and asp.net version a little later.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Euro-Office must default to ODF to be considered "genuinely European", LibreOffice argues by David Uzondu Euro-Office is a web-based collaborative office suite that positions itself as a "European sovereign alternative" to American tech companies, backed by a coalition of developers including Nextcloud, IONOS, Abilian, BTactic, OpenProject, and, more recently, Tuta. The project officially went live a couple of days ago, but not before drawing heavy fire from LibreOffice developers, who called the marketing claim that Euro-Office represents the "first open-source office suite developed in Europe" a deceptive historical inaccuracy because projects like OpenOffice and LibreOffice existed decades earlier. Now that the project has launched, LibreOffice is back with another complaint, arguing that Euro-Office cannot consider itself "genuinely European" while it pushes proprietary Microsoft defaults on users. Euro-Office had promised to improve the OpenDocument Format (ODF) back in April, but the current release still plagues users with several technical failures. For instance, the suite lacks an admin setting to enforce ODF, and mobile editors completely block ODF saves, forcing files into Microsoft's OOXML formats. Some configurations force files into read-only mode, while editing frequently corrupts document formatting or erases data. LibreOffice thinks that merely supporting a format as an afterthought does not make you a sovereign alternative, as file formats are the battleground where" digital sovereignty is won or lost." The road to the first stable release of Euro-Office has been quite bumpy due to an aggressive public fallout with OnlyOffice, from which the coalition originally forked the project. OnlyOffice struck back by accusing the coalition of violating copyright terms under its AGPLv3 branding requirements by stripping the original branding anyway and forking the code. Getting Euro-Office up and running is a bit wonky (at least for non-technical users), as there is no direct installer to grab off the web. The easiest way we learnt is by using Docker. First, pull the official Euro-Office image from the GitHub Container Registry: docker pull ghcr.io/euro-office/documentserver:latest Then, run the container with active ports and a secure JWT token, enabling the test environment: docker run -i -t -d -p 8080:80 --restart=always -e EXAMPLE_ENABLED=true -e JWT_SECRET=my_secure_jwt_secret ghcr.io/euro-office/documentserver:latest And finally, open a web browser and go to the following address: http://localhost:8080 If you are running this on a remote server, replace localhost with your server's IP address. You will see the Euro-Office test page, where you can create new text documents, spreadsheets, or presentations directly in the browser. Image via Euro-Office Nextcloud promises that proper standalone desktop versions and mobile apps will arrive in a future release.
    • It’s any of their products not just windows.
    • Google Gemini has been failing for users across the United States, Europe, and Asia since early Wednesday morning, June 10, 2026, and more than six hours into the incident Google has yet to declare a fix............. https://www.techtimes.com/articles/318152/20260610/google-gemini-outage-tops-six-hours-errors-1076-1099-worldwideflash-lite-still-answers.htm
    • Fun fact: There are more Warhammer 40k games than there are stars in the universe.
    • laughing is tedious. Elephants really are laughing lazy, y'all..
  • Recent Achievements

    • Week One Done
      FBSPL earned a badge
      Week One Done
    • One Year In
      Jim Dugan earned a badge
      One Year In
    • One Month Later
      Tommi118 earned a badge
      One Month Later
    • One Month Later
      sjbousquet earned a badge
      One Month Later
    • Week One Done
      sjbousquet earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      486
    2. 2
      PsYcHoKiLLa
      197
    3. 3
      +Edouard
      155
    4. 4
      Steven P.
      83
    5. 5
      ATLien_0
      69
  • Tell a friend

    Love Neowin? Tell a friend!