• 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

    • Wow, imagine you dump hundreds of hours into completing things and unlocking stuff and you lose it all. Back in the day when cheats were built into games, you could at least unlock things again that way without spending hundreds of hours again. But those days are long gone for some reason as no one builds cheats into games anymore. So it's even more painful that studio that's on its 6th installment **** it up so badly.
    • Spotify finally removes the disco ball app icon in the latest update by Ivan Jenic Image: Spotify Spotify has just released an update that removes its now infamous disco ball icon. The update reverts the app icon to the familiar flat green logo after weeks of mixed reactions online. The icon arrived on May 13 as part of the company's 20th anniversary celebration and was always intended to be temporary, though Spotify only confirmed that after the backlash started. The disco ball took the internet by storm, as the reception was split. A vocal group of users called it ugly and disorienting, with some iOS users noting that the 3D glowing effect made the app look like it was stuck mid-update. On the other end, the icon picked up a following of its own. Its retro, three-dimensional look immediately stood out against the flat, minimalist aesthetic that has dominated app design for years. It even started a small movement, spawning what people started calling "discomorphism," a mashup of disco and skeuomorphism. Other brands started posting disco ball versions of their own logos, probably in an effort to ride the wave of memes that flooded the internet during late May. Spotify has had a turbulent relationship with its user base lately. Besides the disco ball icon, which certainly wasn't appreciated by everyone, the company has also received backlash for its willingness to include AI-generated music on its platform. On May 17, Spotify promised the old icon would return “in a few weeks.” And now it looks like that time has finally arrived. So, whether you liked the disco ball or it made you uncomfortable, it’s now gone for good. The next time you update the Spotify app on your phone, the old, flat-design icon will return.
    • Playground Games confirms Forza Horizon 6 save wipe bug by Taras Buria Forza Horizon 6 was launched last month to critical acclaim (check out our review here), and it became a smash hit in an instant. Now, weeks into the launch, with die-hard fans clocking hundreds of hours, Forza Horizon 6 is facing a serious issue: save wipes. After multiple complaints on Reddit and social media, the studio issued a statement. The problem with missing saves came shortly after Playground Games promised the initial batch of gameplay tweaks and improvements. Unfortunately, there seems to be no temporary fixes for those affected by unexpected save wipes. However, the studio published a new support document with a few important steps users should try. First, affected gamers should open a support ticket immediately (go here to file one) so that the support team can try recovering the lost progress by reverting to an earlier save. Playground Games says this should be done the same day the issue occurs. Meanwhile, gamers are urged not to start new play sessions or create new saves. The studio also published a few things gamers should try to avoid to prevent potential progress loss: Ensure your Gaming Services app on PC or XBOX Series X|S console is fully up to date. On XBOX Series X|S consoles, disable Quick Resume for Forza Horizon 6: To disable Forza Horizon 6 from using Quick Resume, highlight the game box art anywhere in the console experience (Home, My Games & Apps, Pins, etc) and then press the Menu button, then go to Manage game and add-ons > Quick Resume settings > Disable Quick Resume. Ensure you are online when ‘quitting’ the game. Give your saved time to sync to the cloud before powering off or switching devices. Do not force quit the game during save screens. Do not power off the device during gameplay. Always "Quit" (console) or "Exit to desktop" (PC) once you've finished your play session, ensuring the save icon is not visible when you’re closing the game. Before turning off your console, shutting down your PC, or force-closing the Steam app, give your devices or clients at least a few minutes to ensure your latest progress has been synchronized with the cloud. This will reduce the risk of progress reversions as you switch between different platforms. XBOX Series X|S consoles, Steam, and the XBOX app on PC all include game save indicators that confirm your progress has been synced. You can read more about the bug in the official support document here. Forza Horizon 6 is currently available on PC (Steam and the Microsoft Store), Xbox Series X|S, and Game Pass. The game is also coming to PlayStation 5 later this year.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      520
    2. 2
      PsYcHoKiLLa
      197
    3. 3
      +Edouard
      157
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      75
  • Tell a friend

    Love Neowin? Tell a friend!