Update 25/04-2010: Error fixed: "unexpected end of file"
Update 21/03-2010: Added scaling before upload
I was looking for a way to upload my photos to flickr.com just by putting the photos into a specific folder, but was not able to find any working solution. So I made a shell script to do this for me. For this to work I'm using a perl command line uploader (which I'm not the author of).
In the end you will have five folders:
- "private" - photos only viewable by you
- "friend" - photos only viewable by friends
- "family" - photos only viewable by friends and family
- "public" - photos viewable by everybody
- "uploaded" - photos will be moved here after upload (I prefer to move the photos instead of deleting them)
Here goes:
1 ) Create an account at flickr.com (if you haven't got one already)
2 ) Install libflickr-api-perl and ImageMagick
Code:
sudo apt-get install libflickr-api-perl imagemagick
3 ) Download the flickr command line uploader:
http://search.cpan.org/~cpb/Flickr-Upload/flickr_upload
4 ) Uncompress the downloaded file
Code:
tar zxvf flickr-upload.tar.gz
5 ) Jump into the uncompressed folder
6 ) Run Makefile.PL
7 ) Run make command
8 ) Check for errors
9 ) Install the uploader
From here you can only continue if the install went well.
10 ) Run the command and follow the instructions by copying the URL into your browser
Code:
flickr_upload --auth
You will be sendt to Flickr's website and asked to login and agree that Flickr::Upload can access your account.
11 ) After you have finished the wizard on the website press Enter on the command line and a token will show up.
12 ) Copy and paste the token into a new file ".flickrrc" located in your home folder. Open/create file
Put this into the file
Code:
auth_token=<your-token-here>
is_public=0
is_friend=1
is_family=1
You can now test if the uploader works by running the command
Code:
flickr_upload your-image.jpg
13 ) Now decide the location of the upload-folder. I'll presume that you will use your home folder. Jump to the folder (if you are not already there)
14 ) We will call the upload-folder "flickr" and create some sub-folders inside
Code:
mkdir flickr flickr/private flickr/family flickr/friend flickr/public flickr/uploaded
15 ) Download the file attached to this thread and save it as flickr.sh inside the flickr-folder.
Before you continue check if the shell-script works. Do this my placing an image in the "private"-folder. Next run the command to start upload
Code:
bash ~/flickr/flickr.sh
The terminal should tell if the image is getting uploaded. Also go to flickr.com an check your photostream.
16 ) Now we will create a periodic job to make the upload happen
Your crontab should look something like this
Code:
# m h dom mon dow command
*/5 * * * * $HOME/flickr/flickr.sh
This will call the script every 5 minut.
That's about it. You are ready to upload photos. Oh yeah and do tell if this was useful
Bookmarks