via twitterrific
Jan 31
mv t-cottagename-14.jpg t-cottagename-14.jpg Brilliant! Then I thought that because of the patterns in filenames, I didn't need to type a lot of each out each time and by putting the whole thing into a shell script, I could type a single command, save myself a lot of keystrokes and kill two birds with just a single stone. This is what I came up with:
#!/bin/sh
#
# utility to help move images and image thumbs for gallery
#
# Usage: ./thumb_move.sh imageIdentifier oldNumber newNumber
#
if [ $# -eq 3 ]
then
echo "Moving $1-$2.jpg to ../$1-$3.jpg"
echo "Moving t-$1-$2.jpg to ../t-$1-$3.jpg"
mv $1-$2.jpg ../$1-$3.jpg
mv t-$1-$2.jpg ../t-$1-$3.jpg
exit 0
else
echo "\nUsage:"
echo "thumb_move imageIdentifier oldNo newNo"
echo "\nWhere:"
echo "imageIdentifier is the name used in image filenames\n"
echo "oldNo is the old image number.\n"
echo "newNo is the new image number.\n"
exit 1
fi
The gallery which I've just reordered took only 20 minutes. Result!
Stop being scared of the terminal
I don't know about you, but sometimes I think that it's easier to point and click. I know that this isn't true, but sometimes it just feels nicer. This afternoon, I have been reordering a set of images for various image galleries which are automigically built using PHP's brilliant glob function. The thing is that in my cleverness, I had originally opted for a naming system of {gallery_name}#.jpg where # is a number indicating the image order. My first attempts were taking quite literally hours for galleries of 25-50 images in size. This is because I downloaded the images, renamed each one individually using Finder on the Mac (which obviously led to file name conflicts) and taking all of that into account, it took 2-3 minutes per image (plus the time of working out which image needed to go in which position from a sheet of thumbnails). My second attempt was using the command line on the server. This saved loads of time! But required a fair bit of typing which needed to be customised for each image. It was something along the lines of this: mv cottagename-14.jpg cottagename-1.jpg;mv t-cottagename-14.jpg t-cottagename-14.jpg Brilliant! Then I thought that because of the patterns in filenames, I didn't need to type a lot of each out each time and by putting the whole thing into a shell script, I could type a single command, save myself a lot of keystrokes and kill two birds with just a single stone. This is what I came up with:
#!/bin/sh
#
# utility to help move images and image thumbs for gallery
#
# Usage: ./thumb_move.sh imageIdentifier oldNumber newNumber
#
if [ $# -eq 3 ]
then
echo "Moving $1-$2.jpg to ../$1-$3.jpg"
echo "Moving t-$1-$2.jpg to ../t-$1-$3.jpg"
mv $1-$2.jpg ../$1-$3.jpg
mv t-$1-$2.jpg ../t-$1-$3.jpg
exit 0
else
echo "\nUsage:"
echo "thumb_move imageIdentifier oldNo newNo"
echo "\nWhere:"
echo "imageIdentifier is the name used in image filenames\n"
echo "oldNo is the old image number.\n"
echo "newNo is the new image number.\n"
exit 1
fi
The gallery which I've just reordered took only 20 minutes. Result!
Jan 1
Highlights of last year and hopes for this
Last year - highlights:
- Riding Saw: The Ride
- Paris
- Croatia
- Rob Brydon
- Bill Bailey
- Films in 3D
- Building http://scienceoxfordonline.com/
- The new design for http://www.travelexbusiness.com/
- Nice animations on http://ethicore.net
- Building http://sheepskinlife.com
- The way that http://www.skollworldforum.com/ just fell into place
- Freelancing on http://h2r2.co.uk/
- Discovery of Oxford Tuttle
- Going to OxTwestival and winning SEO services which I never used
- Riding Dragon Khan after 14 years of obsessing
- Starting http://coasternerd.com
- Seeing Brainiac live
- Puppies
- Many failed dates
- Seeing Amy again
- Buying 2 iPhones
This year, I hope to:
- Not buy an iPhone
- Go to a new an interesting country - should this be hot or cold?
- Ride Thirteen (at Alton Towers)
- Do another foreign theme park - Cedar Point???!
- Reconnect with old friends (mainly Oli, Ali and Rich)
- Probably much, much more




