Hi
there has been discussions about Photobucket starts to charge money and a lot of our member has now problems with old links to photos.
one member sent me this message and a per script.
do you think it could be used. I havenot included the scrip here.

What do you suggest?
Should I allow anybody to opload photos to out forum, right now its premium members that pay a fee. I'm not sure that allowing everyone is a good ideas cause it will be so many photos over time but I'm open for suggestions.

Thanks


Quote
Hello Morgan,

Here’s the script - photobuckoff.pl

It’s written to work with files, so would not immediately useful for Britbike, which I think holds posts in a database.
If you can tell me what database you’re using and the table structure, I should be able to give you an updated version which will work for Britbike as well.

This could come in handy as people move images to another image hosting site. Get them to give you the old URL and new URL for the images, Then run the script to update the links in their posts.

Anyway, it will work best on a Unix-based system such as Linux or OS X, but there are versions of Perl available for Windows.
You will also need the Getopt::Long Perl module installed

There are 4 ways to run it

1/ specify the input & output files, and the old and new URLs
perl photobuckoff.pl -s <source file> -d <destination file> -o <old URL> -n <new URL>

2/ specify the input & output files, and a file with an old and new URL on each line
perl photobuckoff.pl -s <source file> -d <destination file> -f <file containing URLs>

3/ specify the input & output directories, and the old and new URLs
perl photobuckoff.pl -s <source directory> -d <destination directory> -o <old URL> -n <new URL>

4/ specify the input & output directories, and a file with an old and new URL on each line
perl photobuckoff.pl -s <source directory> -d <destination directory> -f <file containing URLs>

where:
<source file> is the file you want to fix
<destination file> is the file which will will have the updates applied (avoid overwriting your original)
<old URL> is the URL you want to replace
<new URL> is the URL you want to replace it with
<file containing URLs> is a file with a pair of URLs on each line. The first is the one you want replaced, the second is what will replace it

The script will replace every occurrence of the old string with the new string.

If you specify directories, it will work on every file in the directory, and all the subdirectories.

If you have a file with pairs of URLs, these will be sorted by length and alphabetically. It runs through each old URL for each line, which can be a bit of a trap if one of the shorter URLs is a subset of one of the longer replacements - you can wind up with some odd looking results.


An example would be:
perl photobuckoff.pl -s tom.html -d harry.html -o http://photobucket.com/users/shane -n http://britbike.com/home/shane


Morgan Johansson
BritBike Forum
https://www.britbike.com/forums/ubbthreads.php