This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
stickrs /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README | ||
| |
config.yml.sample | Sat Sep 27 13:40:06 -0700 2008 | |
| |
dadaist-photos.rb | Sat Sep 27 15:31:03 -0700 2008 | |
| |
lib/ | Sat Sep 27 15:32:18 -0700 2008 | |
| |
stripy-photos.rb | Sat Sep 27 15:31:03 -0700 2008 |
README
stickrs
=======
Some silly stickers you can make out of your Flickr images.
Description
-----------
The main code resides in an abstract class to handle grabbing photographs from flickr and turning them into somewhat
surreal stickers. Any "working" processor should subclass that and implement a #process_each_image method, which should
return an array of images ready for writing.
Aside from the processing code, the script also contains the code necessary to SFTP the images to a webserver, from
where the Moo API can obtain the images and manufacture stickers out of them.
Samples
-------
There are two example scripts here, Both are somewhat surreal.
dadaist-photos.rb
-----------------
This is a very silly script. What it does, in a nutshell:
1) Gets your n latest photographs from Flickr
2) For each picture it:
a) Calculates the "average" colour of the picture
b) Generates a square image
i) With the background colour set to that average colour
ii) And with the title of the photograph overlaid in white text
It generates square images so that you can produce stickers of your photos on moo.com.
You now have stickers that are far higher fidelity than any photograph could be at 300dpi.
stripy-photos.rb
----------------
This is less silly, and perhaps more aesthetically pleasing:
1) Gets your n latest photographs from Flickr
2) For each picture it:
a) Turns it into a 300x300 square
b) Takes the central row of pixels in that square
c) Replaces every row of pixels in the square with the central row.
The net result is an often aesthetically pleasing series of stripy squares.
Usage
-----
Copy config.yml.sample to config.yml and fill it out with:
- your Flickr API key
- your Moo API key
- SFTP details for a server you own. You'll need:
- the host (eg: http://www.example.com)
- valid username/password for SFTP
- the *full* path to where your images should be SFTP'd to, *with trailing slash*
- the *full* public facing URL where your images will be visible if successfully copied, *with trailing slash*
then:
ruby name-of-script.rb flickr-user-email-address limit-number-of-pictures (purchase|preview)
The email address is the email address used by the individual user at Flickr.
The limit should be an integer.
If you leave off "purchase", the files will simply be uploaded to your web server and you'll be given URLs for them. If
you add purchase, a moo.com order for stickers will be created, and you'll be given a URL to view that order.
Alternatively, replacing "purchase" with "preview" will dump the XML for your order out to the command prompt. You can
run this through the Moo validator (http://www.moo.com/api/validator.php) to check if things are all coming out OK.
stickr uses SFTP. If you already have an SSH key set up on your server, you will be asked for that when the script
authorizes against SFTP.
Requirements
------------
ImageMagick
RMagick
Hprciot
Net::Flickr (http://code.google.com/p/net-flickr/ - sudo gem install net-flickr)
HTMLEntities
Net::SSH
Ruminant
- a gem for Ruby that makes it easy to write to the Moo API. Install it thus:
gem sources -a http://gems.github.com
and then
sudo gem install infovore-ruminant
Flickr API key (get one at http://www.flickr.com/services/api/keys/apply/)
MOO API key (get one at http://www.moo.com/api/key.php)
Authors
-------
Tom Armitage (tom@infovore.org)







