<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Random Musings&#187; website management</title> <atom:link href="http://www.nslms.com/tag/website-management/feed/" rel="self" type="application/rss+xml" /><link>http://www.nslms.com</link> <description></description> <lastBuildDate>Wed, 06 Jul 2011 20:47:34 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>Tools for updating an online image gallery</title><link>http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/#comments</comments> <pubDate>Fri, 07 Mar 2008 03:12:51 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[automation]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[website management]]></category> <guid
isPermaLink="false">http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/</guid> <description><![CDATA[Not long ago I shared my bash script for creating thumbnails and manageable sized &#8220;big&#8221; images for an image gallery, or other image store. Well, today I had to update an existing gallery with a pretty significant number of new images. It occurred to me that I&#8217;d like to only convert new images rather than [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2008%2F03%2F06%2Ftools-for-updating-an-online-image-gallery%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2008%2F03%2F06%2Ftools-for-updating-an-online-image-gallery%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>Not long ago I shared my bash script for <a
href="http://www.nslms.com/2008/02/20/image-thumbnail-generating-script/">creating thumbnails</a> and manageable sized &#8220;big&#8221; images for an image gallery, or other image store.  Well, today I had to update an existing gallery with a pretty significant number of new images.  It occurred to me that I&#8217;d like to only convert new images rather than re-converting the whole lot.  Then, I&#8217;d like to simply upload the new files to my server in some automated way.</p><p>So here&#8217;s the tools to do it.  It assumes you have the same layout for your pictures on your local drive as I do, which is as follows.</p><ul><li><strong><em>RootDirectoryForGallery</em></strong> &#8212; This contains the full resolution pictures directly from your camera, and the following directories.<ul><li><strong><em>web</em></strong> &#8212; This is a sub directory of RootDirectoryForGallery which contains the &#8220;big&#8221; web version of your image, and the thumbnails directory described below.<ul><li><strong><em>thumbnails</em></strong> &#8212; This is a sub directory of web, and contains the thumbnail sized versions of the images.</li></ul></li></ul></li></ul><p>The first step, is to copy your new pictures from the digital camera to your <strong><em>RootDirectoryForGallery</em></strong>.  Then, we want to get a list of the files that are new, so we run the following from the <strong><em>RootDirectoryForGallery</em></strong>.</p><pre lang="bash">
diff . web/ | grep 'Only in \.: d' | awk '{print $4}' | grep jpg &gt;&gt; 3-6-08_update.diff</pre><p>This creates a file in the <strong><em>RootDirectoryForGallery</em></strong> named &#8220;3-6-08_update.diff&#8221; which contains a list of only the new pictures, one per line.  Now, we want to use our image thumbnail script to convert only the new images to the &#8220;big&#8221; and thumbnail sized images.  I discovered that I needed to make a change to my script in order to do this.  Namely in the for loop I needed to enclose the command used to list files in &#8220;$()&#8221;.  The modified script is shown below.  Notice the &#8220;$($SEARCH)&#8221; where there was previously just &#8220;$SEARCH&#8221;.</p><pre lang="bash">
#!/bin/bash
SEARCH=$1
SIZE=$2
DEST=$3
if [ $# -lt 3 ]
then
echo "You must pass three arguments 1) The search string (usually *.jpg) 2) The destination size I.E. 500x374 3) The destination directory"
exit 1
fi
for i in $($SEARCH)
do
        echo "Converting $i"
        convert -resize $SIZE $i -resize $SIZE +profile '*' $DEST$i
done</pre><p>So with our edited script we convert the files.</p><pre lang="bash">
/opt/imagethumbnail.sh "cat 3-6-08_update.diff" "800x600" "web/"
/opt/imagethumbnail.sh "cat 3-6-08_update.diff" "150×112 "web/_thb_"</pre><p>Lastly, we want to upload just the changed files to our server.  We&#8217;ll use rsync for this.  The paths, server name, and user name have been changed to protect the innocent. <img
src='http://www.nslms.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p><pre lang="bash">
rsync -e ssh -av /path/to/local/copy/ yourusername@yourserver.com:/path/to/www/server/copy/</pre><p>And there you have it, with just a few simple commands you&#8217;ve created thumbnails of all of your images, and uploaded just the new ones to your server.  Easy!</p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Tools%20for%20updating%20an%20online%20image%20gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Tools+for+updating+an+online+image+gallery&amp;link=http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/&amp;notes=Not%20long%20ago%20I%20shared%20my%20bash%20script%20for%20creating%20thumbnails%20and%20manageable%20sized%20%22big%22%20images%20for%20an%20image%20gallery%2C%20or%20other%20image%20store.%20%20Well%2C%20today%20I%20had%20to%20update%20an%20existing%20gallery%20with%20a%20pretty%20significant%20number%20of%20new%20images.%20%20It%20occurred%20to%20me%20that%20I%27d%20like%20to%20only%20convert%20new%20images%20rath&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2008/03/06/tools-for-updating-an-online-image-gallery/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
