Sharing a folder's content using rss



Hi there,

I’d like to create a folder with photos in that can be subscribed to using rss. Is this possible and straightforward ish?

Thanks in advance


Hi Simon,

Do you mean so that when you upload a new photo to the folder, a new item is posted in the RSS file?

If so, you could:

a. Write a little file upload script which adds an entry to the RSS feed, so when you add a new photo, the RSS is automatically updated (xml file).

b. Write a script that checks the contents of the folder, and looks for any new files. That way you can upload a file via ftp and then have the cron job (scheduled task) run every so often to rebuild the RSS feed (xml file).

c. Manually update an RSS feed (xml file) when you add a new photo.

I’d opt for method “a” if you can. That way changes are updated in real time.

If you need any help implementing any of those methods, i’m sure lots of us will be happy to help you. Just ask.


web design, development & seo by DigitalVibe


As a variation on b, you can dynamically generate the XML used for RSS everytime a user requests the feed. This would be my approach, because it keeps the RSS feed always up to date, and you don’t have to worry about maintaining a separate xml file like you would for any of digitalvibe’s solutions.


Yeah, i didn’t really think out “b” very well… I’m usually the first to say “create it when it’s needed” rather than having a cron job doing it all the time…

If you were to opt for “b”, definitely go for Alpicola’s suggestion. It effectily does the same job, but only when someone actually wants the file.

Also, you would have the RSS feed with an extension “.php”, rather than “.xml”. This will still work perfectly well :slight_smile:


web design, development & seo by DigitalVibe



I’ve just been sat wondering how to do this, and well… i’ve done it for you.

You may want to add bits to the script to filter out the extensions you want to include/exclude, but this script works perfectly well to list all files in a folder along with their upload date.

You won’t have descriptions etc as there is no data to check them against… we’re just looking at files on a server.

Anyway, here’s a link to sample RSS feed for files in a folder generated based on filename and upload date.

I’ve zipped up the source for you to download if you want to try it. Download the php source code for “sample RSS feed for files in a folder generated based on filename and upload date”

Hope this works okay for you. Like i said, the code “works”, but if you upload an html file to the folder, that’ll show in the feed too, so if you’re going to be putting other stuff in the same folder, you’ll need to put some sort of check on the extension.

Let me know how it goes :slight_smile: .

If you’re feeling generous and want to link to my site as “payment”, I’ll happily accept a link to with the text “web design, web development, seo” :wink:


web design, development & seo by DigitalVibe


In addition, if you’re going to have loads of photos in the folder and you only want the latest x number appearing, then you should have some preliminary code to build an array of all images on the page, sorted by upload date/time.

You can then grab the most recent x number of files from the array and build the RSS feed with those. :slight_smile:

If you need help, i’ll be able to write you some sample code.


web design, development & seo by DigitalVibe



Thanks for the replies everyone. I’m still having a bit of trouble with it. Here’s what the problem is. I want to share a folder of photos so my parents with iPhoto on their mac can use the “Subscribe to photo feed” option. You can do it with flickr but I wanted to use my own webspace and put the highest res photos on there. When i link to the rss.php file it says there are no photos. I assume because the file displays a list as opposed to the photos themselves. Is there a way around this does anyone know?

Simon :slight_smile:


Hi Simon,

I’ve made the modifications to the code to facilitate this for you. Have a look at the working example on my site, and if it’s what you want, feel free to download the zip file again - i’ve updated the contents for you.

What this will do is link directly to the image full size.

If you want the RSS feed to display a thumbnail only, and then you click it for a full size version, let me know… that’s a whole new barrel of fun altogether!


web design, development & seo by DigitalVibe


Nice script digital !!

I got the impression he’s chasing a full picture feed. A clickable thumbnail feed would be the better choice.


Thanks a lot for your help, the new script works great!



No problem Simon, bear in mind this script will show the full size image, so if they are high res and you just want to use the feed to link to the full size images on your server, then the script can be modified to use thumbnails.

I would just change the RSS paths to a thumbs directory, and keep the links pointing the the full size image dir.

You could either:

  1. upload your own thumbnails
  2. write an upload script to upload a full size image and generate a thumbnail version.

the first is the least tech savvy one, providing you can resize images yourself.

the latter is good if you know php… you’ll be creating a script to automate the whole process.


web design, development & seo by DigitalVibe


Thank you :slight_smile:

Yeah it’s easy enough to have it running off thumbs, as per my other post - a php script would do the trick.

That’s what i’ve done for the paintings section of

I am however running the full size images through a php script to add the watermark “sample” text when you click a painting thumbnail.


web design, development & seo by DigitalVibe



This script is amazing. I tried it and it works perfect as it is. Thanks a lot.
But, for this to work in my case, i need some modifications, i thought maybe you could shed some light on what i want to do.
I’m a copy/paster when it comes to php, so any help is appreciated.

Well what i want to do with the script is:

I’m trying to setup a kind of an online record label for some bands i work with. And i’m doing this using wordpress with special templates and the “SimplePie” rss parser plugin.

I want the users to upload their files to a directory on the server. The rss generator script will generate the uptodate rss and the simplepie will parse it in a wordpress page.

So, i have a tree structure like this:

media folder
|-a user folder
|-another user folder

and so on…

The script, as it is, ignores the subdirectories. Is it possible to modify the script to output something like this:

link to the mp3 file mp3 file name .... ....

I’m not really sure about the xml syntax, but i guess this gives an idea of what i want to achieve.

Where should i start?

Thanks in advance.


well…a bit reading on rss syntax tells me that the layout i was proposing is actually not rss. am i right?

another option for what i want to achieve would be to pass the “albumfoldername” to the description tag of rss file?


A better solution would be to use the tag. You could place the name of the album inside the and save the for describing the actual file. You can take a look at the spec for more details.

The key to making the script work is probably to do some sort of recursion. You could wrap the while loop in a function which takes the directory name as an argument and if readdir() points you at a subdirectory, recursively call the function on that new subdirectory. I haven’t got the time to hash the code out, but I think it should be fairly straightforward.


This is EXACTLY what I’m looking for. Does somebody still have it?

Thank you!!!