Download Wireless-Hacks-100-strength-tips 4547KB
Transcript
echo $count > $filepath/count if [ $count = 1 ]; then echo "There is 1 image in the queue" > $filepath/notify else echo "There are $count images in the queue" > $filepath/notify fi if [ $count = $perpage ]; then echo "<html><head><title>$title</title></head><body bgcolor=000000><center>" > $filepath/archive/$time.html cat $filepath/index.txt >> $filepath/archive/$time.html cp $filepath/new.txt $filepath/index.txt rm $filepath/count rm $filepath/new.txt cat $filepath/arc.txt > $filepath/arc.tmp echo "<li><a href=\"$baseref/archive/$time.html\">$arcdate</a></li>" >> $filepath/arcn.txt cat $filepath/arc.tmp >> $filepath/arcn.txt rm $filepath/arc.tmp mv $filepath/arcn.txt $filepath/arc.txt echo "There are no new images in the queue" > $filepath/notify fi rm -rf ~/.$$ In addition to this script, you need a copy of munpack (to decode mime attachments) and convert (part of the Image Magick suite). These tools are available in all standard Linux distributions. Finally, create an index.shtml file in your web server's document root that contains a line like this: <!--#include virtual="index.txt"--> For a more advanced example of what you can do with the index.shtml file, take a look at the example available at http://freenetworks.org/~mattw/badsoftware/phonecam/index.shtml.txt. Running the Hack With all of the above in place, simply send a photo via email to your secret photo email address. The script automatically decodes the email, creates a thumbnail, and puts the photo into a queue. When the queue accumulates perpage photos, it rotates in the page full of photos, and moves the old page into an archive. You can always access the latest photo at http://server/~yourname/phonecam/latest.jpg, and see the entire pending queue at http://server/~yourname/phonecam/new.txt. The script manages the queue and archives without any intervention, and will even post an optional description of your photos. Just add a text body to the email and it will be inserted as the photo's description. This script could probably be simplified and improved, but this simple shell script should run on just about any server. It creates a simple but powerful archiving web interface that is easily integrated into a weblog or other existing web page. And it pushes the instant gratification of digital photos even further, into the realm of instant publication. See Also Matt Westervelt's phonecam project ( Page 48