<?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>Superdit.com &#187; image</title>
	<atom:link href="http://superdit.com/tag/image/feed/" rel="self" type="application/rss+xml" />
	<link>http://superdit.com</link>
	<description>blogging, design, tech, and web</description>
	<lastBuildDate>Thu, 19 Jan 2012 07:50:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>8 Javascript Mobile Web Image Gallery Library</title>
		<link>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/</link>
		<comments>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 04:31:06 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=4102</guid>
		<description><![CDATA[This post I compiled some examples I found for creating image gallery in mobile web, cause compared to web desktop, creating image gallery in mobile devices must be different, we have to thinking about limited screen resolution, supported event, etc. And these library &#38; tutorial might help you to get started creating your own mobile<a href="http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>This post I compiled some examples I found for creating image gallery in mobile web, cause compared to web desktop, creating image gallery in mobile devices must be different, we have to thinking about limited screen resolution, supported event, etc. And these library &amp; tutorial might help you to get started creating your own mobile web gallery, and some of them a have tried it on my local computer, using iPhone simulator.</p>
<h5>Photo Swipe</h5>
<p>PhotoSwipe is a free HTML/CSS/JavaScript based image gallery targeting mobile devices, <a href="http://www.photoswipe.com/latest/examples/jquery-mobile.html" target="_blank">demo</a>.</p>
<p><a href="http://www.photoswipe.com/ " target="_blank"><img title="" src="http://superdit.com/wp-content/uploads/2011/08/04.png" alt="" width="488" height="332" /></a></p>
<h5><span id="more-4102"></span>Awesome Mobile Image Gallery Web App</h5>
<p>This is a tutorial blog post written by tympanus.net, really good example to showing step by step creating mobile web image gallery using jQTouch, <a href="http://tympanus.net/Tutorials/WonderwallMobileGallery/" target="_blank">demo</a>.</p>
<p><a title="Awesome Mobile Image Gallery Web App" href="http://tympanus.net/codrops/2010/05/27/awesome-mobile-image-gallery-web-app/" target="_blank"><img class="alignnone size-full wp-image-7939" title="" src="http://superdit.com/wp-content/uploads/2011/08/01.png" alt="" width="489" height="331" /></a></p>
<h5>Tiny Circleslider</h5>
<p>Tiny Circleslider is a circular slider or carousel build based on jquery library, this one have a unique interface as a gallery to be used, the radius size can be customized so it will fit in any mobile devices.</p>
<p><a title="Tiny Circleslider" href="http://baijs.nl/tinycircleslider/" target="_blank"><img class="alignnone size-full wp-image-7940" title="" src="http://superdit.com/wp-content/uploads/2011/08/02.png" alt="" width="490" height="331" /></a></p>
<h5>Touch Gallery</h5>
<p>A fullscreen photo gallery for touch-devices.</p>
<p><a title="Touch Gallery" href="http://neteye.github.com/touch-gallery.html" target="_blank"><img class="alignnone size-full wp-image-7941" title="" src="http://superdit.com/wp-content/uploads/2011/08/03.png" alt="" width="498" height="330" /></a></p>
<h5>jQTouch Extensions</h5>
<p>jQExtensions is a collection of extensions for the jQTouch mobile web app framework based on jQuery. This one already discontinued but have a good example used to creating simple photo gallery, <a href="http://samshull.com/jqtouch-r148/demos/main/#home" target="_blank">demo</a>.</p>
<p><a title="jQTouch Extensions" href="http://code.google.com/p/jqextensions/" target="_blank"><img class="alignnone size-full wp-image-7943" title="" src="http://superdit.com/wp-content/uploads/2011/08/05.png" alt="" width="489" height="331" /></a></p>
<h5>Jaipho</h5>
<p>Jaipho is a mobile web gallery inspired by original iPhone photo application, <a href="http://www.jaiphodemo.info/" target="_blank">demo</a>.</p>
<p><a title="Jaipho" href="http://www.jaipho.com/   " target="_blank"><img class="alignnone size-full wp-image-7945" title="" src="http://superdit.com/wp-content/uploads/2011/08/06.png" alt="" width="489" height="331" /></a></p>
<h5>Galleria</h5>
<p>I&#8217;m not really testing this one but from the documentation you can see swipe features, which mean you can use it on mobile devices.</p>
<p><a title="Galleria Aino" href="http://galleria.aino.se/ " target="_blank"><img class="alignnone size-full wp-image-7946" title="" src="http://superdit.com/wp-content/uploads/2011/08/07.png" alt="" width="489" height="331" /></a></p>
<h5>TN3 Gallery</h5>
<p>Like galleria I&#8217;m not really testing this one but from the sites says it supported mobile devices.</p>
<p><a title="TN3 Gallery" href="http://www.tn3gallery.com " target="_blank"><img class="alignnone size-full wp-image-7947" title="" src="http://superdit.com/wp-content/uploads/2011/08/08.png" alt="" width="489" height="331" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sliding Stacked Images With JQuery</title>
		<link>http://superdit.com/2011/05/14/sliding-stacked-images-with-jquery/</link>
		<comments>http://superdit.com/2011/05/14/sliding-stacked-images-with-jquery/#comments</comments>
		<pubDate>Sat, 14 May 2011 01:09:53 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[slider]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=6433</guid>
		<description><![CDATA[A sliding door effect can be used what the site offer. About a week ago I visited a site called auroraos, on the first page I see a nice sliding image gallery on the front page, it used JQuery to creating the effect, it like a vertical accordion, sliding door effect or whatever you called<a href="http://superdit.com/2011/05/14/sliding-stacked-images-with-jquery/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>A sliding door effect can be used what the site offer. About a week ago I visited a site called <a title="auroraos" href="http://www.auroraos.org/" target="_blank">auroraos</a>, on the first page I see a nice sliding image gallery on the front page, it used JQuery to creating the effect, it like a vertical accordion, sliding door effect or whatever you called it.</p>
<p><a title="Sliding Stacked Images With JQuery" href="http://superdit.com/2011/05/14/sliding-stacked-images-with-jquery/"><img class="alignnone size-full wp-image-6589" title="jquery sliding stacked images" src="http://superdit.com/wp-content/uploads/2011/05/jquery_sliding_stacked_images_thumb.png" alt="jquery sliding stacked images" width="540" height="200" /></a></p>
<p>All the images must have the same size, in both width and height, the hovered images will shows entirely, and the others will mostly hidden.<span id="more-6433"></span></p>
<p style="text-align: center;"><a title="JQuery Sliding Stacked Images Demo" href="http://demo.superdit.com/jquery/sliding_stacked/" target="_blank">View Demo</a> | <a title="JQuery Sliding Stacked Images Download" href="http://www.box.net/shared/qnlkg3bk5d" target="_blank">Download Source</a></p>
<h5>HTML</h5>
<p>In this example I&#8217;m using 5 images, like before we have to set the <em>overflow</em> css property to <em>hidden</em> so all the images can be expanded in the background, you can see on the CSS code section.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;container&quot;&gt;
    &lt;div id=&quot;img_container&quot;&gt;
        &lt;img id=&quot;img1&quot; src=&quot;img/01.jpg&quot;/&gt;
        &lt;img id=&quot;img2&quot; src=&quot;img/02.jpg&quot;/&gt;
        &lt;img id=&quot;img3&quot; src=&quot;img/03.jpg&quot;/&gt;
        &lt;img id=&quot;img4&quot; src=&quot;img/04.jpg&quot;/&gt;
        &lt;img id=&quot;img5&quot; src=&quot;img/05.jpg&quot;/&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<h5>JQuery</h5>
<p>This example set all the images position using JQuery, on the <em>$(document).ready();</em> function, to make it easier where to move the images when an images hover, I set all the position in array. And there is two recursive function i used here, they are used when JQuery must loop on the prev and next images until no images found anymore.</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
    var cwidth = parseInt($(&quot;#container&quot;).css(&quot;width&quot;).replace(&quot;px&quot;, &quot;&quot;));
    var img_count = $(&quot;#img_container&quot;).children().length;
    var img_width = $(&quot;#img1&quot;).width();
    var divider = cwidth / img_count;
    var small_space = (cwidth - img_width) / (img_count - 1);

    // set position
    var cssleft = Array();
    $(&quot;#img_container img&quot;).each(function(index) {
        cssleft[index] = new Array();
        // set default position
        cssleft[index][0] = (index * divider) - (index * img_width);
        $(this).css(&quot;left&quot;, cssleft[index][0] + &quot;px&quot;);

        // set left position
        cssleft[index][1] = (index * small_space) - (index * img_width);

        // set right position
        var index2 = index;
        if (index2 == 0) {
            index2++;
        }
        cssleft[index][2] = cssleft[index2 - 1][1];
    });

    // image hover
    $(&quot;#img_container img&quot;).mouseenter(function() {
        var img_id = parseInt($(this).attr(&quot;id&quot;).replace(&quot;img&quot;, &quot;&quot;)) - 1;

        if ($(this).attr(&quot;id&quot;) != &quot;img1&quot;) {
            $(this).animate({
                left: cssleft[img_id][1]
            }, 300);
        }
        loopNext(this);
        loopPrev(this);
    });

    // image container hover out back to default position
    $(&quot;#img_container&quot;).mouseleave(function() {
        $(&quot;#img_container img&quot;).each(function(index) {
            $(this).animate({
                left: cssleft[index][0]
            }, 300);
        });
    });

    function loopPrev(el) {
        if ($(el).prev().is(&quot;img&quot;)) {
            var imgprev_id = parseInt($(el).attr(&quot;id&quot;).replace(&quot;img&quot;, &quot;&quot;));

            if ($(el).prev().attr(&quot;id&quot;) != &quot;img1&quot;) {
                $(el).prev().animate({
                    left: cssleft[imgprev_id - 2][1]
                }, 300);
            }
            loopPrev($(el).prev());
        }
    }

    function loopNext(el) {
        if ($(el).next().is(&quot;img&quot;)) {
            var imgnext_id = parseInt($(el).attr(&quot;id&quot;).replace(&quot;img&quot;, &quot;&quot;));

            $(el).next().animate({
                left: cssleft[imgnext_id][2]
            }, 300);
            loopNext($(el).next());
        }
    }
});
</pre>
<h5>CSS</h5>
<p>I&#8217;m using the box shadow effect to the space between each image, so not to get confused.</p>
<pre class="brush: css; title: ; notranslate">
#container {
    margin: 0 auto;
    margin-top: 50px;
    width: 800px;
    height: 350px;
    overflow: hidden;
    border: 10px solid #000;
    -webkit-border-radius: .5em;
    -moz-border-radius: .5em;
    border-radius: .5em;
}
#img_container {
    width: 4000px;
}
#img_container img {
    position: relative;
    -moz-box-shadow: -5px 0 10px #000;
    -webkit-box-shadow: -5px 0 10px #000;
    box-shadow: -5px 0 10px #000;
    width: 600px;
}
#img1 { z-index: 0; }
#img2 { z-index: 1; }
#img3 { z-index: 2; }
#img4 { z-index: 3; }
#img5 { z-index: 4; }
</pre>
<p style="text-align: center;"><a title="JQuery Sliding Stacked Images Demo" href="http://demo.superdit.com/jquery/sliding_stacked/" target="_blank">View Demo</a> | <a title="JQuery Sliding Stacked Images Download" href="http://www.box.net/shared/qnlkg3bk5d" target="_blank">Download Source</a></p>
<p style="text-align: center;"><a title="JQuery Sliding Stacked Images Demo" href="http://demo.superdit.com/jquery/sliding_stacked/" target="_blank"><img class="size-full wp-image-6595" title="jquery sliding stacked images" src="http://superdit.com/wp-content/uploads/2011/05/jquery_sliding_stacked_images_big.png" alt="jquery sliding stacked images" width="540" height="252" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/05/14/sliding-stacked-images-with-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>10 Free Image Editor For Windows</title>
		<link>http://superdit.com/2011/04/11/10-free-image-editor-for-windows/</link>
		<comments>http://superdit.com/2011/04/11/10-free-image-editor-for-windows/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 11:25:39 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=6013</guid>
		<description><![CDATA[Maybe you want to start a design graphic career or business with low cost, all these software here are maybe can be one of your choice as a photoshop alternative. You can click on the each images to visit the official site and must be easy to find the download link. GIMP Gimp is my<a href="http://superdit.com/2011/04/11/10-free-image-editor-for-windows/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>Maybe you want to start a design graphic career or business with low cost, all these software here are maybe can be one of your choice as a photoshop alternative. You can click on the each images to visit the official site and must be easy to find the download link.</p>
<h5>GIMP</h5>
<p>Gimp is my one of favorite image editing application, it have very large community, google &#8220;gimp tutorial&#8221; you will find a bunch of tutorial from beginner to advanced skill, but some users and me too complained about the user interface.</p>
<p><a title="GIMP" href="http://www.gimp.org/" target="_blank"><img class="aligncenter size-full wp-image-6023" title="GIMP" src="http://superdit.com/wp-content/uploads/2011/04/01-gimp.png" alt="GIMP" width="540" height="351" /><span id="more-6013"></span></a></p>
<h5>Paint.NET</h5>
<p>Paint.NET is my second favorite application for editing image, cause it very fast loading, I&#8217;m use this application along side with GIMP, because so far I tried Paint.NET has a better quality in resizing image than GIMP, especially when resizing image with text.</p>
<p><a title="Paint.NET" href="http://www.getpaint.net/" target="_blank"><img class="aligncenter size-full wp-image-6025" title="Paint.NET" src="http://superdit.com/wp-content/uploads/2011/04/02-paintdotnet.png" alt="Paint.NET" width="540" height="301" /></a></p>
<h5>Pinta Project</h5>
<p>Pinta Project is basically Paint.NET clone created for Linux platform, created based on GTK, and now it is available for windows.</p>
<p><a title="Pinta Project" href="http://pinta-project.com/" target="_blank"><img class="aligncenter size-full wp-image-6027" title="Pinta Project" src="http://superdit.com/wp-content/uploads/2011/04/03-pinta.png" alt="Pinta Project" width="540" height="300" /></a></p>
<h5>Photoscape</h5>
<p><a title="Photoscape" href="http://www.photoscape.org" target="_blank"><img class="aligncenter size-full wp-image-6026" title="Photoscape" src="http://superdit.com/wp-content/uploads/2011/04/04-photoscape.png" alt="Photoscape" width="540" height="301" /></a></p>
<h5>Artweaver Free</h5>
<p><a title="Artweaver Free" href="http://www.artweaver.de/home-en/" target="_blank"><img class="aligncenter size-full wp-image-6032" title="Artweaver" src="http://superdit.com/wp-content/uploads/2011/04/artweaver-rounded.png" alt="Artweaver" width="540" height="301" /></a></p>
<h5>Pixia</h5>
<p><a title="Pixia" href="http://www.ne.jp/asahi/mighty/knight/download.html" target="_blank"><img class="aligncenter size-full wp-image-6033" title="Pixia" src="http://superdit.com/wp-content/uploads/2011/04/pixia-rounded.png" alt="Pixia" width="540" height="300" /></a></p>
<h5>PhotoFiltre</h5>
<p><a title="PhotoFiltre" href="http://photofiltre.free.fr/download_en.htm" target="_blank"><img class="aligncenter size-full wp-image-6028" title="Photofiltre" src="http://superdit.com/wp-content/uploads/2011/04/photofiltre-rounded.png" alt="Photofiltre" width="540" height="301" /></a></p>
<h5>PaintStar</h5>
<p><a title="PaintStar" href="http://sites.google.com/site/wangzhenzhou/" target="_blank"><img class="aligncenter size-full wp-image-6029" title="PaintStar" src="http://superdit.com/wp-content/uploads/2011/04/PaintStar-rounded.png" alt="PaintStar" width="540" height="322" /></a></p>
<h5>Hornil Stylepix</h5>
<p><a title="Hornil Stylepix" href="http://hornil.com/en/downloads/stylepix/" target="_blank"><img class="aligncenter size-full wp-image-6031" title="Hornil" src="http://superdit.com/wp-content/uploads/2011/04/hornil-rounded.png" alt="Hornil" width="540" height="301" /></a></p>
<h5>PhotoPlus Starter Edition</h5>
<p><a title="PhotoPlus Starter Edition" href="http://www.serif.com/free-photo-editing-software/php-se.asp" target="_blank"><img class="aligncenter size-full wp-image-6038" title="PhotoPlus Starter Edition" src="http://superdit.com/wp-content/uploads/2011/04/photoplus-starter-edition.jpg" alt="PhotoPlus Starter Edition" width="540" height="333" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/04/11/10-free-image-editor-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ExtJS Thumb Viewer Using Dataview</title>
		<link>http://superdit.com/2011/02/11/extjs-thumb-viewer-using-dataview/</link>
		<comments>http://superdit.com/2011/02/11/extjs-thumb-viewer-using-dataview/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 06:25:24 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Extjs]]></category>
		<category><![CDATA[dataview]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=4925</guid>
		<description><![CDATA[In this post I want to create an example thumb viewer in ExtJS, if you have tried old software like gqview, you may familiar with this thumb viewer, well not really complicated actually, just love to use it when reading my favorite comic. View Demo &#124; Download Source The ExtJS The main component of this<a href="http://superdit.com/2011/02/11/extjs-thumb-viewer-using-dataview/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-5117" title="extjs thumb viewer dataview" src="http://superdit.com/wp-content/uploads/2011/02/extjs_thumb_viewer_dataview.png" alt="extjs thumb viewer dataview" width="540" height="150" /></p>
<p>In this post I want to create an example thumb viewer in ExtJS, if you have tried old software like <a title="gqview" href="http://gqview.sourceforge.net/" target="_blank">gqview</a>, you may familiar with this thumb viewer, well not really complicated actually, just love to use it when reading my favorite comic.<span id="more-4925"></span></p>
<p style="text-align: center;"><a href="http://demo.superdit.com/ext_thumb_dataview" target="_blank">View Demo</a> | <a href="http://www.box.net/shared/6m48fb9fsd" target="_blank">Download Source</a></p>
<h5>The ExtJS</h5>
<p>The main component of this viewer is two dataview, one for thumbnails and another one for the original image. When a thumbnail clicked the relevant image show in the dataview that contain the original image, using some old html trick, jump to some html element based on id, like <em>#divid</em>.</p>
<pre class="brush: jscript; title: ; notranslate">
Ext.onReady(function() {
    /* =======================================
     * start component for thumbnails panel */
    var storeThumbs = new Ext.data.JsonStore({
        proxy: new Ext.data.HttpProxy({
            url: 'get-images.php', method: 'POST'
        }),
        root: 'images',
        fields: [
            'id', 'name', 'url',
            { name: 'size', type: 'float' },
            'thumb_url'
        ]
    });

    storeThumbs.load();

    var tplThumbs = new Ext.XTemplate(
        '&lt;tpl for=&quot;.&quot;&gt;',
            '&lt;div class=&quot;thumb-box&quot;&gt;',
                '&lt;a href=&quot;#{id}&quot;&gt;',
                    '&lt;img src=&quot;{thumb_url}&quot; title=&quot;{name}&quot;&gt;',
                '&lt;/a&gt;',
            '&lt;/div&gt;',
        '&lt;/tpl&gt;'
    );

    var dvThumbs = new Ext.DataView({
        autoScroll: true, store: storeThumbs, tpl: tplThumbs,
        autoHeight: false, height: 410, multiSelect: true,
        overClass: 'x-view-over', itemSelector: 'div.thumb-wrap',
        emptyText: 'No images to display',
        border: false
    });

    // Panel for the thumbnails
    var panelThumbs = new Ext.Panel({
        region: 'west',
        split: false,
        width: 160,
        margins:'5 5 5 0',
        items: [dvThumbs]
    });
    /* end component for thumbnails panel
     * =================================== */

    /* =======================================
     * start component for large panel */
    var storeLarge = new Ext.data.JsonStore({
        proxy: new Ext.data.HttpProxy({
            url: 'get-images.php', method: 'POST'
        }),
        root: 'images',
        fields: [
            'id', 'name', 'url',
            { name: 'size', type: 'float' },
            'thumb_url'
        ]
    });
    storeLarge.load();

    var tplLarge = new Ext.XTemplate(
        '&lt;tpl for=&quot;.&quot;&gt;',
            '&lt;div class=&quot;large-box&quot; id=&quot;{id}&quot;&gt;',
                '&lt;img src=&quot;{url}&quot; title=&quot;{name}&quot;&gt;',
            '&lt;/div&gt;',
        '&lt;/tpl&gt;'
    );

    var dvLarge = new Ext.DataView({
        autoScroll: true, store: storeLarge, tpl: tplLarge,
        autoHeight: false, height: 410, multiSelect: true,
        overClass: 'x-view-over', itemSelector: 'div.thumb-wrap',
        emptyText: 'No images to display',
        border: false
    });

    // Panel for large images
    var panelLarge = new Ext.Panel({
        region: 'center',
        margins:'5 0 5 0',
        items:[dvLarge]
    });
    /* end component for large panel
     * =================================== */

    var win = new Ext.Window({
        title: 'ExtJS Images Viewer',
        closable: false,
        width: 620,
        height: 450,
        border: false,
        plain: true,
        layout: 'border',
        items: [panelThumbs, panelLarge]
    });

    win.show(this);
});
</pre>
<h5>The PHP</h5>
<p>This php code is very similar to the script from the <a title="ExExtjs: Simple Image Gallery Using DataView and PHP" href="http://superdit.com/2010/07/21/extjs-simple-image-gallery-using-dataview-and-php/" target="_blank">ExtJS image gallery post</a>, just add an <em>id</em> inside the array.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$dir = &quot;img/large/&quot;;
$dir_thumbs = &quot;img/thumbs/&quot;;

$images = array();
$d = dir($dir);
$loop = 0;
while($name = $d-&gt;read()){
    if(!preg_match('/\.(jpg|gif|png)$/', $name)) continue;
    $size = filesize($dir.$name);
    $thumb = $name;
    $loop++;
    $images[] = array('id'=&gt; 'img_'.$loop, 'name' =&gt; $name,
                    'size' =&gt; $size, 'url' =&gt; $dir.$name,
                    'thumb_url' =&gt; $dir_thumbs.$thumb);
}
$d-&gt;close();
$o = array('images'=&gt;$images);
echo json_encode($o);
</pre>
<h5>Dataview CSS</h5>
<pre class="brush: css; title: ; notranslate">
.thumb-box  {
    width: 100px;
    padding: 5px;
    text-align: center;
    margin: 13px auto;
    background: #ccd8e7;
    border: 1px solid #99BBE8;
    -webkit-border-radius: .5em;
    -moz-border-radius: .5em;
    border-radius: .5em;
}

.thumb-box:hover {
    background: #999999;
    border-color: #999999;
}

.large-box {
    width: 375px;
    margin: 15px auto;
}
</pre>
<p style="text-align: center;"><a href="http://demo.superdit.com/ext_thumb_dataview" target="_blank">View Demo</a> | <a href="http://www.box.net/shared/6m48fb9fsd" target="_blank">Download Source</a></p>
<p style="text-align: center;"><a href="http://demo.superdit.com/ext_thumb_dataview/" target="_blank"><img class="aligncenter size-full wp-image-5122" title="extjs thumb viewer dataview" src="http://superdit.com/wp-content/uploads/2011/02/extjs_thumb_viewer_dataview_capture.png" alt="extjs thumb viewer dataview" width="540" height="394" /></a></p>
<p><em>Credit Images: <a href="http://flickr.com" target="_blank">Flickr</a></em><em> [ <a href="http://www.flickr.com/photos/libertymorningstar/5428014531/" target="_blank">images 1</a> ], [ <a href="http://www.flickr.com/photos/96919150@N00/103439599/" target="_blank">images 2</a> ], [ <a href="http://www.flickr.com/photos/flaviocb/3880246186/" target="_blank">images 3</a> ], [ <a href="http://www.flickr.com/photos/joorgawt/3375087291/" target="_blank">images 4</a> ], [ <a href="http://www.flickr.com/photos/arihahn/314472601/" target="_blank">images 5</a> ]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/02/11/extjs-thumb-viewer-using-dataview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic PHP Image Watermark With GD Library</title>
		<link>http://superdit.com/2011/02/01/basic-php-image-watermark-with-gd-library/</link>
		<comments>http://superdit.com/2011/02/01/basic-php-image-watermark-with-gd-library/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 06:15:45 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=4766</guid>
		<description><![CDATA[For today just wanna go back to a little PHP code again, I want share to creating a very basic image watermarking in PHP, watermark  feature are already widely used in some popular digital art, and photo websites like istockphotos, deviantart and any other sites, that maybe I don&#8217;t even know. Now here it goes,<a href="http://superdit.com/2011/02/01/basic-php-image-watermark-with-gd-library/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>For today just wanna go back to a little PHP code again, I want share to creating a very basic image watermarking in PHP, watermark  feature are already widely used in some popular digital art, and photo websites like <a title="istockphotos" href="http://www.istockphoto.com" target="_blank">istockphotos</a>, <a title="Deviant Art" href="http://deviantart.com" target="_blank">deviantart</a> and any other sites, that maybe I don&#8217;t even know. Now here it goes, first make sure you have GD installed with PHP, you can check on your default phpinfo page using <em>&lt;?php phpinfo(); ?&gt;</em>, or you can use this php script</p>
<pre class="brush: php; title: ; notranslate">
if (!function_exists(&quot;gd_info&quot;)) {
	echo &quot;GD not installed&quot;;
} else {
	echo &quot;GD installed&quot;;
}
</pre>
<p><span id="more-4766"></span></p>
<h6>Text Watermark</h6>
<p>Now let&#8217;s get straight to the code, the first way to adding watermarking is by add text which called true type font on the server, you can freely choose the font you want to use and it will be better to include the font file in the server.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

header(&quot;Content-type: image/jpeg&quot;);

// get image file
$img_name = &quot;batman.jpg&quot;;
$img_src = imagecreatefromjpeg($img_name);
$width_src = imagesx($img_src);
$height_src = imagesy($img_src);

// new image size = old image size
$width_dst = $width_src;
$height_dst = $height_src;
$quality = 80;

// create new image
$img = imagecreatetruecolor($width_src, $height_dst);
imagecopyresampled($img, $img_src, 0, 0, 0, 0, $width_dst, $height_dst, $width_src, $height_src);

// rectangle size for text box
$x1_rect = 0;
$y1_rect = $height_dst - 18;
$x2_rect = $width_dst;
$y2_rect = $height_dst;

$color = imagecolorallocate($img, 0, 0, 0);
$letter_color = imagecolorallocate($img, 255, 255, 255);
$text = &quot;scissormetimbers (http://scissormetimbers.deviantart.com)&quot;;
imagefilledrectangle($img, $x1_rect, $y1_rect, $x2_rect, $y2_rect, $color);
imagettftext($img, 12, 0, $x1_rect+5, $y1_rect+14, $letter_color, &quot;DroidSans.ttf&quot;, $text);

// show in browser
imagejpeg($img, '', $quality);

imagedestroy($img_src);
imagedestroy($img);

?&gt;
</pre>
<h6>Image Watermark</h6>
<p>If in someway you want to adding an image you can add this code, before the image showing in the browser, I think it is better to choose the image with the transparent background, for watermarking.</p>
<pre class="brush: php; title: ; notranslate">
$logo = imagecreatefromgif(&quot;da.gif&quot;);
imagecopymerge($img, $logo, 200, 50, 0, 0, 300, 300, 80);
</pre>
<p>Here are the example result, using both text and image watermark</p>
<p><img class="size-full wp-image-4892 alignnone" title="php watermark sample" src="http://superdit.com/wp-content/uploads/2011/02/sample.png" alt="php watermark sample" width="540" height="451" /></p>
<h6>Saving The File</h6>
<p>To save the modified image modify this line of code</p>
<pre class="brush: php; title: ; notranslate">
imagejpeg($img, '', $quality);
</pre>
<p>to</p>
<pre class="brush: php; title: ; notranslate">
imagejpeg($img, 'new_image_name.jpg', $quality);
</pre>
<h6 style="text-align: center;"><a title="basic php watermark demo" href="http://demo.superdit.com/php_basic_watermark/" target="_blank">View Demo</a> | <a href="http://www.box.net/shared/qxg4p5ee1m" target="_blank">Download Source</a></h6>
<p><em><strong>Credit Image</strong>: <a href="http://scissormetimbers.deviantart.com/art/Batman-77165699" target="_blank">Batman</a></em><br />
<em><strong>Font</strong>: <a href="http://www.fontsquirrel.com/fonts/Droid-Sans" target="_blank">Droid Sans</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/02/01/basic-php-image-watermark-with-gd-library/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rotating Image Using JQuery</title>
		<link>http://superdit.com/2011/01/06/rotating-image-using-jquery/</link>
		<comments>http://superdit.com/2011/01/06/rotating-image-using-jquery/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 10:17:57 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[rotate]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=3800</guid>
		<description><![CDATA[This is my experimental code using JQuery, in this post I want to show you the way how to rotating image using JQuery, so this is what I will create, single image with one button controller that located in the center of the image, and to rotate it user must drag the center button (which<a href="http://superdit.com/2011/01/06/rotating-image-using-jquery/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>This is my experimental code using JQuery, in this post I want to show you the way how to rotating image using JQuery, so this is what I will create, single image with one button controller that located in the center of the image, and to rotate it user must drag the center button (which mean right click and hold) and the image angle will change based on mouse position.</p>
<p style="text-align: center;"><a href="http://superdit.com/2011/01/06/rotating-image-using-jquery/"><img class="size-full wp-image-3814 alignnone" title="jQuery Image Rotate Thumb" src="http://superdit.com/wp-content/uploads/2011/01/jQuery-Image-Rotate2.png" alt="" width="500" height="172" /></a><span id="more-3800"></span></p>
<h6 style="text-align: center;"><a title="jQuery Image Rotate Demo" href="http://demo.superdit.com/jquery_image_rotate/" target="_blank">View Demo</a> | <a title="jQuery Image Rotate Download Source" href="http://www.box.net/shared/12txo3grfd" target="_blank">Download Source</a></h6>
<p>Let&#8217;s get through the code, here are the html code</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;container&quot;&gt;
    &lt;p&gt;
        &lt;a href=&quot;&quot;&gt;Back to Post&lt;/a&gt;
        &amp;nbsp;&amp;nbsp;
        &lt;a href=&quot;&quot;&gt;Download Source&lt;/a&gt;
    &lt;/p&gt;
    &lt;p&gt;Drag On The Center Image to Rotate&lt;/p&gt;
    &lt;div id=&quot;bt_drag&quot;&gt;
        &lt;img id=&quot;icon&quot; src=&quot;img/rotate_64.png&quot;/&gt;
    &lt;/div&gt;
    &lt;div id=&quot;bt_center&quot;&gt;
        &lt;img id=&quot;icon&quot; src=&quot;img/rotate_64.png&quot;/&gt;
    &lt;/div&gt;
    &lt;div id=&quot;box&quot;&gt;&lt;img src=&quot;img/img.jpg&quot;/&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>You can see on the code above, I&#8217;m using JQuery UI to do a little tricky in rotate controller, there will be two rotate controller inside the image, when user dragging the controller one will stay in the center of image and one will be draggable to track mouse position, and to track when <em>mouseup event</em> being triggered, and now is the javascript code in JQuery</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
    $(&quot;#bt_drag&quot;).draggable({ containment: &quot;#container&quot; });

    var bPos = $(&quot;#box&quot;).offset();
    var bWidth = $(&quot;#box&quot;).width();
    var bHeight = $(&quot;#box&quot;).height();

    var center_top = (bHeight + bPos.top) - (bHeight / 2) - 16;
    var center_left = (bWidth + bPos.left) - (bWidth / 2) - 16;

    $(&quot;#bt_drag&quot;).show();
    $(&quot;#bt_center&quot;).show();

    $(&quot;#bt_drag&quot;).css(&quot;top&quot;, center_top);
    $(&quot;#bt_drag&quot;).css(&quot;left&quot;, center_left);

    $(&quot;#bt_center&quot;).css(&quot;top&quot;, center_top);
    $(&quot;#bt_center&quot;).css(&quot;left&quot;, center_left);

    $(document).mousemove(function(e){
        window.mouseXPos = e.pageX;
        window.mouseYPos = e.pageY;
    });

    $(&quot;#bt_drag&quot;).mousedown(function(e) {
        var bPos = $(&quot;#box&quot;).offset();
        var bWidth = $(&quot;#box&quot;).width();
        var bHeight = $(&quot;#box&quot;).height();

        var center_top = (bHeight + bPos.top) - (bHeight / 2);
        var center_left = (bWidth + bPos.left) - (bWidth / 2);

        intervalId = setInterval(function() {
            y = center_top - window.mouseYPos + 32;
            x = window.mouseXPos - center_left - 32;

            r = 360 - (180/Math.PI) * Math.atan2(y,x);

            $(&quot;#box&quot;).css(&quot;transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#box&quot;).css(&quot;-moz-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#box&quot;).css(&quot;-webkit-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#box&quot;).css(&quot;-o-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);

            $(&quot;#bt_drag&quot;).css(&quot;transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_drag&quot;).css(&quot;-moz-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_drag&quot;).css(&quot;-webkit-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_drag&quot;).css(&quot;-o-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);

            $(&quot;#bt_center&quot;).css(&quot;transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_center&quot;).css(&quot;-moz-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_center&quot;).css(&quot;-webkit-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
            $(&quot;#bt_center&quot;).css(&quot;-o-transform&quot;,&quot;rotate(&quot;+r+&quot;deg)&quot;);
        }, 100);
    }).mouseup(function() {
        clearInterval(intervalId);
        var currentPos = $(&quot;#bt_center&quot;).offset();
        $(&quot;#bt_drag&quot;).animate({
            top: currentPos.top,
            left: currentPos.left
            }, &quot;slow&quot;, function() {
        });
    });
});
</pre>
<p>If you are separating the javascript code make sure you include it in the bottom, before the<em> &lt;/body&gt;</em> closing tag, I experience a little bug in Safari and Chrome. Last is the CSS code</p>
<pre class="brush: css; title: ; notranslate">
* {
    font-family: Arial, &quot;Free Sans&quot;;
}
body {
    background: #fff url('../img/pattern8-pattern-014.png') repeat right top;
}

#container {
    margin:0 auto;
    text-align: center;
}
#box {
    margin: 0 auto;
    width: 381px;
    height: 333px;
    padding: 7px;
    background: #fff;
    -moz-box-shadow: 2px 2px 5px #333;
    -webkit-box-shadow: 2px 2px 5px #333;
    box-shadow: 2px 2px 5px #333;
    position: relative;
}
#bt_drag, #bt_center {
    display: none;
    position: absolute;
    z-index: 25;
    height: 64px;
    width: 64px;
    padding: 5px;
    background: #d3d3d3;
    -webkit-border-radius: 2.5em;
    -moz-border-radius: 2.5em;
    border-radius: 2.5em;
    opacity:0.7;
    filter: alpha(opacity=70);
    cursor: move;
}
#bt_drag {
    opacity:0.3;
    filter: alpha(opacity=30);
}
#bt_center {
    z-index: 20;
}
#rotate_icon a img, #bt_center a img {
    border: 1px solid #fff;
}
p {
    text-shadow: 2px 2px 2px #333;
    font-size: 30px;
    fon-weight: bold;
    color: #fff;
}
p a {
    opacity: 0.8;
    filter: alpha(opacity=30);
    padding: 10px 15px;
    -webkit-border-radius: 2.5em;
    -moz-border-radius: 2.5em;
    border-radius: 2.5em;
    background: #fff;
    font-size: 24px;
    text-shadow: 1px 1px 1px #333;
    color: #000;
    text-decoration: none;
}
p a:hover {
    background: #d3d3d3;
}
</pre>
<p>That&#8217;s all really easy isn&#8217;t? like always here are the the example screen capture, download link and online demo, and because this is using CSS3 this example won&#8217;t work in current available IE (very old IE, IE6, IE7 or IE8). One more thing if you want another way to rotate image here is the more advanced tutorial <a title="Create Smooth Rotatable Images with CSS3 and jQuery" href="http://www.elated.com/articles/smooth-rotatable-images-css3-jquery/" target="_blank">smooth rotatable image</a>.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-3811" title="jQuery Image Rotate Screen" src="http://superdit.com/wp-content/uploads/2011/01/jQuery-Image-Rotate.png" alt="" width="500" height="505" /></p>
<h6 style="text-align: center;"><a title="jQuery Image Rotate Demo" href="http://demo.superdit.com/jquery_image_rotate/" target="_blank">View Demo</a> | <a title="jQuery Image Rotate Download Source" href="http://www.box.net/shared/12txo3grfd" target="_blank">Download Source</a></h6>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/01/06/rotating-image-using-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Create Collage Image Gallery With Jquery</title>
		<link>http://superdit.com/2010/12/28/create-collage-image-gallery-with-jquery/</link>
		<comments>http://superdit.com/2010/12/28/create-collage-image-gallery-with-jquery/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 07:13:48 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[collage]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=2801</guid>
		<description><![CDATA[In this post I want to share how to create very simple Collage Image Gallery using Jquery, actually the idea creating this is from my previous post, all of this sample image I&#8217;m using from this flickr group, this sample is using 15 images, the images will be static, here is the code for the<a href="http://superdit.com/2010/12/28/create-collage-image-gallery-with-jquery/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>In this post I want to share how to create very simple Collage Image Gallery using Jquery, actually the idea creating this is from my <a title="Moving Element To Random Position Inside A Container" href="http://superdit.com/2010/12/25/moving-element-to-random-position-inside-a-container/" target="_blank">previous post</a>, all of this sample image I&#8217;m using from this <a title="Black and White Photography, Flickr Group" href="http://www.flickr.com/groups/74977771@N00/" target="_blank">flickr group</a>, this sample is using 15 images, the images will be static, here is the code for the main html element.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;body&gt;
&lt;div id=&quot;top&quot;&gt;
    &lt;button id=&quot;btscamble&quot; class=&quot;button&quot; onclick=&quot;scramble();&quot;&gt;
        Scramble Collage
    &lt;/button&gt;

    &lt;button id=&quot;btreset&quot; class=&quot;button&quot;&gt;
        Reset Collage
    &lt;/button&gt;
&lt;/div&gt;
&lt;div id=&quot;container&quot;&gt;
    &lt;div id=&quot;box1&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/01.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box2&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/02.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box3&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/03.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box4&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/04.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box5&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/05.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box6&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/06.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box7&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/07.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box8&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/08.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box9&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/09.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box10&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/10.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box11&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/11.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box12&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/12.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box13&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/13.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box14&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/14.jpg&quot;/&gt;&lt;/div&gt;
    &lt;div id=&quot;box15&quot; class=&quot;box&quot;&gt;&lt;img src=&quot;img/thumbs/15.jpg&quot;/&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;mymenu&quot;&gt;
    &lt;a href=&quot;&quot; id=&quot;btfront&quot;&gt;Bring To Front&lt;/a&gt;
    &lt;a href=&quot;&quot; id=&quot;btback&quot;&gt;Bring Backward&lt;/a&gt;
&lt;/div&gt;
&lt;/body&gt;
</pre>
<p><span id="more-2801"></span></p>
<p>There are two button in this sample one for scrambling all the images, which mean make images move to random position and on reset button for resetting all the images to default position, and there is a menu that will be display when right click on the image triggered, the menu contains option for bring to front or backward. And here the code for javascript contoller, I called <em>controller.js</em></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
	// give all the box to be draggable
    var children = $(&quot;#container&quot;).children();
    var child = $(&quot;#container div:first-child&quot;);

    for (i=0; i&lt;children.length; i++) {
        $(&quot;#&quot;+child.attr(&quot;id&quot;)).draggable({
            containment: &quot;#container&quot;, scroll: false
        });
        child = child.next();
    }

	// set for custom right click menu
	var clickedId;

    $(&quot;.box&quot;).bind(&quot;contextmenu&quot;,function(e){
        $(&quot;#mymenu&quot;).animate({
            top: e.pageY,
            left: e.pageX
            }, 'fast', function() {
        }).show();

        clickedId = $(this).attr(&quot;id&quot;);
        $(&quot;.box&quot;).css(&quot;background&quot;, &quot;#fff&quot;);
        $(&quot;#&quot;+clickedId).css(&quot;background&quot;, &quot;#666&quot;);

        return false;
    });

    // action on bring to front or backward
    var maxZindex = 1;
    var minZindex = 1;

    $(&quot;#btfront&quot;).click(function() {
        maxZindex++;
        $(&quot;#&quot;+clickedId).css(&quot;z-index&quot;, &quot;&quot;+maxZindex);
        return false;
    });

    $(&quot;#btback&quot;).click(function() {
        minZindex--;
        $(&quot;#&quot;+clickedId).css(&quot;z-index&quot;, &quot;&quot;+minZindex);
        return false;
    });

	// reset style of box and menu
    $(&quot;body, #container, .box, #btback, #btfront, #btscamble&quot;).click(function() {
        $(&quot;#mymenu&quot;).hide();
        $(&quot;.box&quot;).css(&quot;background&quot;, &quot;#fff&quot;);
    });

    // reset button action, reset style and current max, min z-index
    $(&quot;#btreset&quot;).click(function() {
		$(&quot;.box&quot;).removeAttr(&quot;style&quot;);
		$(&quot;.box&quot;).css(&quot;position&quot;, &quot;relative&quot;);
		maxZindex = 1;
		minZindex = 1;
		return false;
	});
});

/* this function from:
 * http://www.admixweb.com/2010/08/24/javascript-tip-get-a-random-number-between-two-integers/
 */
function randomFromTo(from, to){
    return Math.floor(Math.random() * (to - from + 1) + from);
}

function scramble() {
    var children = $('#container').children();
    var child = $('#container div:first-child');
    for (i=0; i&lt;children.length; i++) {
        $(&quot;#&quot;+child.attr('id')).css(&quot;position&quot;, &quot;absolute&quot;);
        moveRandom(child.attr('id'));
        child = child.next();
    }
}

function moveRandom(id) {
    /* get container position and size
     * -- access method : cPos.top and cPos.left */
    var cPos = $('#container').offset();
    var cHeight = $('#container').height();
    var cWidth = $('#container').width();

    // get box padding (assume all padding have same value)
    var pad = parseInt($('#container').css('padding-top').replace('px', ''));

    // get movable box size
    var bHeight = $('#'+id).height();
    var bWidth = $('#'+id).width();

    // set maximum position
    maxY = cPos.top + cHeight - bHeight - pad;
    maxX = cPos.left + cWidth - bWidth - pad;

    // set minimum position
    minY = cPos.top + pad;
    minX = cPos.left + pad;

    // set new position
    newY = randomFromTo(minY, maxY);
    newX = randomFromTo(minX, maxX);

    $('#'+id).animate({
        top: newY,
        left: newX
        }, 'slow', function() {
    });
}
</pre>
<p>On the code above line 2 &#8211; 11 I make it all the images to be draggable, I&#8217;m using <a title="jQuery UI" href="http://jqueryui.com/" target="_blank">jqueryui</a> to make this happen, so don&#8217;t forget to include in your main html file. Line 14 &#8211; 28 is to make custom right click on the images, so the menu can be displayed. Line 31 &#8211; 44 is for manipulating css z-index, this is the action for the right click options menu, and the rest is for resetting images to default position, and scrambling images to random position. And here is the css code</p>
<pre class="brush: css; title: ; notranslate">
* {
    font-family: Arial, &quot;Free Sans&quot;;
}

body {
    background:#ffffff url('../img/webtreats-paper-pattern-6-grey.jpg') repeat right top;
}

#mymenu {
    background: #fff;
    padding: 5px;
    position: absolute;
    display: none;
    -moz-box-shadow: 2px 2px 5px #333;
    -webkit-box-shadow: 2px 2px 5px #333;
    box-shadow: 2px 2px 5px #333;
    z-index: 999999;
    display: none;
}

#mymenu a {
    display:block;
    padding: 5px;
    text-decoration: none;
    color: #333;
    font-size: 14px;;
}

#mymenu a:hover {
    background: #d3d3d3;
}

#top {
    margin: 0 auto;
    text-align: center;
    border: 4px dashed #d9d9d9;
    padding: 10px;
    width: 785px;
    margin-bottom: 10px;
}
#container {
    margin: 0 auto;
    width: 785px;
    height: 470px;
    padding: 10px;
    border: 4px dashed #666;
}

.box {
    cursor: move;
    padding: 5px;
    background: #fff;
    width: 125px;
    height: 125px;
    background: #f3f3f3;
    float: left;
    margin: 10px;
    border:1px solid #d3d3d3;
    -moz-box-shadow: 2px 2px 5px #333;
    -webkit-box-shadow: 2px 2px 5px #333;
    box-shadow: 2px 2px 5px #333;
    z-index: 1;
}

/* this CSS3 button get from this
 * http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/
 */

.button {
    display: inline-block;
    outline: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font: 14px/100% Arial, Helvetica, sans-serif;
    padding: .5em 2em .55em;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
    -webkit-border-radius: .5em;
    -moz-border-radius: .5em;
    border-radius: .5em;
    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
    -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.button:hover {
    text-decoration: none;
}
.button:active {
    position: relative;
    top: 1px;
}
</pre>
<p>The css3 button I got from <a title="css3 gradient button" href="http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/" target="_blank">webdesignerwall</a>, it won&#8217;t work on IE 6 or 7 (and I haven&#8217;t tested on IE 8), Lastly this is the screen capture, the download link, and you can view it online too, but IE6 won&#8217;t work and if you have some bug in opera for the draggable function, try to update to the <a title="Download Latest Opera Version" href="http://www.opera.com/download/" target="_blank">latest opera version</a> (currently when I write this post is version 11), and I hope in my future post I can adding some more feature. Thanks for reading.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-3678" title="Jquery Image Collage Screenshot" src="http://superdit.com/wp-content/uploads/2010/12/Jquery-Image-Collage.png" alt="" width="500" height="355" /></p>
<p style="text-align: center;"><a title="Jquery Image Collage Demo" href="http://demo.superdit.com/jquery_image_collage/" target="_blank">View Demo</a> | <a title="Jquery Image Collage Download Source" href="http://www.box.net/shared/9d09qz5449" target="_blank">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/12/28/create-collage-image-gallery-with-jquery/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Cropping Image To Square Dimension With CodeIgniter</title>
		<link>http://superdit.com/2010/07/14/cropping-image-to-square-dimension-with-codeigniter/</link>
		<comments>http://superdit.com/2010/07/14/cropping-image-to-square-dimension-with-codeigniter/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 09:21:03 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=1499</guid>
		<description><![CDATA[I&#8217;ve posted similar article before but this time I want to do it with codeigniter, codeigniter have a powerful image manipulation class, in this post I will use it to make thumbnail square from image, let get directly to the code. I make the function inside the controller, this code is cropping image that already<a href="http://superdit.com/2010/07/14/cropping-image-to-square-dimension-with-codeigniter/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve posted similar article <a title="Cropping Image to Square Dimension Using PHP" href="http://superdit.com/2010/07/01/cropping-image-to-square-dimension-using-php/" target="_blank">before</a> but this time I want to do it with codeigniter, codeigniter have a powerful <a title="Codeigniter Image Manipulation" href="http://codeigniter.com/user_guide/libraries/image_lib.html" target="_blank">image manipulation class</a>, in this post I will use it to make thumbnail square from image, let get directly to the code. I make the function inside the controller, this code is cropping image that already located on the server so the image path (not URL) have to be defined.<span id="more-1499"></span></p>
<p>If you have dynamic variable to locate image on the server you can create function to check image type wheter is .png, .gif or .jpg then use the PHP GD function (imagecreatefromjpeg or imagecreatefrompng or imagecreatefromgif) to get the image width and height, in this code below it assume the image only in .jpg format.</p>
<p>And if you want to crop image from the uploaded file by the user it will make it easier, cause when you use codeigniter <a title="CodeIgniter File Uploading Class" href="http://codeigniter.com/user_guide/libraries/file_uploading.html" target="_blank">file uploading class</a> there&#8217;s a built in property to get uploaded image width and image height automatically after the image was uploaded.</p>
<pre class="brush: php; title: ; notranslate">
public function crop()
{
    $img_path = 'uploads\capsamples.jpg';
    $img_thumb = 'uploads\capsamples_thumb.jpg';

    $config['image_library'] = 'gd2';
    $config['source_image'] = $img_path;
    $config['create_thumb'] = TRUE;
    $config['maintain_ratio'] = FALSE;

    $img = imagecreatefromjpeg($img_path);
    $_width = imagesx($img);
    $_height = imagesy($img);

    $img_type = '';
    $thumb_size = 100;

    if ($_width &gt; $_height)
    {
        // wide image
        $config['width'] = intval(($_width / $_height) * $thumb_size);
        if ($config['width'] % 2 != 0)
        {
            $config['width']++;
        }
        $config['height'] = $thumb_size;
        $img_type = 'wide';
    }
    else if ($_width &lt; $_height)
    {
        // landscape image
        $config['width'] = $thumb_size;
        $config['height'] = intval(($_height / $_width) * $thumb_size);
        if ($config['height'] % 2 != 0)
        {
            $config['height']++;
        }
        $img_type = 'landscape';
    }
    else
    {
        // square image
        $config['width'] = $thumb_size;
        $config['height'] = $thumb_size;
        $img_type = 'square';
    }

    $this-&gt;load-&gt;library('image_lib');
    $this-&gt;image_lib-&gt;initialize($config);
    $this-&gt;image_lib-&gt;resize();

    // reconfigure the image lib for cropping
    $conf_new = array(
        'image_library' =&gt; 'gd2',
        'source_image' =&gt; $img_thumb,
        'create_thumb' =&gt; FALSE,
        'maintain_ratio' =&gt; FALSE,
        'width' =&gt; $thumb_size,
        'height' =&gt; $thumb_size
    );

    if ($img_type == 'wide')
    {
        $conf_new['x_axis'] = ($config['width'] - $thumb_size) / 2 ;
        $conf_new['y_axis'] = 0;
    }
    else if($img_type == 'landscape')
    {
        $conf_new['x_axis'] = 0;
        $conf_new['y_axis'] = ($config['height'] - $thumb_size) / 2;
    }
    else
    {
        $conf_new['x_axis'] = 0;
        $conf_new['y_axis'] = 0;
    }

    $this-&gt;image_lib-&gt;initialize($conf_new);

    $this-&gt;image_lib-&gt;crop();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/07/14/cropping-image-to-square-dimension-with-codeigniter/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Basic Image Gallery With CodeIgniter</title>
		<link>http://superdit.com/2010/06/27/basic-image-gallery-with-codeigniter/</link>
		<comments>http://superdit.com/2010/06/27/basic-image-gallery-with-codeigniter/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 14:13:53 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=839</guid>
		<description><![CDATA[CodeIgniter is quite mature framework to creating web application, the built in libraries and helper very helpful to creating most feature in web application, this post I want to create very basic image gallery using CodeIgniter, the the built in libraries that I used are File Uploading, Image Manipulation and Pagination, whereas the used helper<a href="http://superdit.com/2010/06/27/basic-image-gallery-with-codeigniter/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter is quite mature framework to creating web application, the built in libraries and helper very helpful to creating most feature in web application, this post I want to create very basic image gallery using CodeIgniter, the the built in libraries that I used are <a title="CodeIgniter File Uploading Class" href="http://codeigniter.com/user_guide/libraries/file_uploading.html" target="_blank">File Uploading</a>, <a title="CodeIgniter Image Manipulation Class" href="http://codeigniter.com/user_guide/libraries/image_lib.html" target="_blank">Image Manipulation</a> and <a title="CodeIgniter Pagination Class" href="http://codeigniter.com/user_guide/libraries/pagination.html" target="_blank">Pagination</a>, whereas the used helper is <a title="CodeIgniter URL Helper" href="http://codeigniter.com/user_guide/helpers/url_helper.html" target="_blank">URL Helper</a>, and here&#8217;s we go</p>
<p>First open the <em>config.php</em> in folder <em>system/application/config/</em> and set the CodeIgniter base_url</p>
<pre class="brush: php; title: ; notranslate">
$config['base_url'] = &quot;http://localhost/ci_gallery/&quot;;
</pre>
<p>Next load the URL Helper in <em>autoload.php </em>in the same folder as above file</p>
<pre class="brush: php; title: ; notranslate">
$autoload['helper'] = array('url');
</pre>
<p>Now create the image controller in file <em>image.php</em> inside folder <em>system/application/controller</em> and add this attribute inside the image class</p>
<pre class="brush: php; title: ; notranslate">
private $data = array(
    'dir' =&gt; array(
        'original' =&gt; 'assets/uploads/original/',
        'thumb' =&gt; 'assets/uploads/thumbs/'
    ),
    'total' =&gt; 0,
    'images' =&gt; array(),
    'error' =&gt; ''
);
</pre>
<p><span id="more-839"></span></p>
<p>The varible above created to store the default directory path, total images inside the folder, and error message while uploading the image, the value of those variables will set in the next function. Add the function index inside the Image class</p>
<pre class="brush: php; title: ; notranslate">
public function index($start = 0)
{
    if ($this-&gt;input-&gt;post('btn_upload')) {
        $this-&gt;upload();
    }

    $this-&gt;load-&gt;library('pagination');

    $c_paginate['base_url'] = site_url('image/index');
    $c_paginate['per_page'] = '9';
    $finish = $start + $c_paginate['per_page'];

    if (is_dir($this-&gt;data['dir']['thumb']))
    {
        $i = 0;
        if ($dh = opendir($this-&gt;data['dir']['thumb'])) {
            while (($file = readdir($dh)) !== false) {
                // get file extension
                $ext = strrev(strstr(strrev($file), &quot;.&quot;, TRUE));
                if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') {
                    if ($start &lt;= $this-&gt;data['total'] &amp;&amp; $this-&gt;data['total'] &lt; $finish) {
                        $this-&gt;data['images'][$i]['thumb'] = $file;
                        $this-&gt;data['images'][$i]['original'] = str_replace('thumb_', '', $file);
                        $i++;
                    }
                    $this-&gt;data['total']++;
                }
            }
            closedir($dh);
        }
    }

    $c_paginate['total_rows'] = $this-&gt;data['total'];

    $this-&gt;pagination-&gt;initialize($c_paginate);

    $this-&gt;load-&gt;view('images/index', $this-&gt;data);
}
</pre>
<p>Inside the index function it called the upload function when upload button clicked by the user, and the pagination class is configured, the script is looping through the folder find whether the file is image or not, and now the upload function</p>
<pre class="brush: php; title: ; notranslate">
private function upload()
{
    $c_upload['upload_path']    = $this-&gt;data['dir']['original'];
    $c_upload['allowed_types']  = 'gif|jpg|png|jpeg|x-png';
    $c_upload['max_size']       = '500';
    $c_upload['max_width']      = '1600';
    $c_upload['max_height']     = '1200';
    $c_upload['remove_spaces']  = TRUE;

    $this-&gt;load-&gt;library('upload', $c_upload);

    if ($this-&gt;upload-&gt;do_upload()) {

        $img = $this-&gt;upload-&gt;data();

        // create thumbnail
        $new_image = $this-&gt;data['dir']['thumb'].'thumb_'.$img['file_name'];

        $c_img_lib = array(
            'image_library'     =&gt; 'gd2',
            'source_image'      =&gt; $img['full_path'],
            'maintain_ratio'    =&gt; TRUE,
            'width'             =&gt; 100,
            'height'            =&gt; 100,
            'new_image'         =&gt; $new_image
        );

        $this-&gt;load-&gt;library('image_lib', $c_img_lib);
        $this-&gt;image_lib-&gt;resize();
    } else {
        $this-&gt;data['error'] = $this-&gt;upload-&gt;display_errors();
    }
}
</pre>
<p>You can see on the code above, thumbnail is created every time image is uploaded to maximum size 100 x 100 pixels, and putted in the different folder , the last function is delete image</p>
<pre class="brush: php; title: ; notranslate">
public function delete($ori_img)
{
    unlink($this-&gt;data['dir']['original'].$ori_img);
    unlink($this-&gt;data['dir']['thumb'].'thumb_'.$ori_img);
    redirect('/');
}
</pre>
<p>The function getting the parameter as image name and deleted the orginal and thumbnail image,  and now the view file <em>index.php</em> inside folder <em>system/application/views/images/</em></p>
<pre class="brush: php; title: ; notranslate">
&lt;!-- the javascript code to load clicked image and changing the class--&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    function changepic(img_src, obj) {
        document[&quot;img_tag&quot;].src = img_src;
        var thumbs = document.getElementsByName(&quot;thumb&quot;);
        for (var i = 0; i &lt; thumbs.length; i++) {
            var tmp_id = &quot;thumb_&quot; + i;
            document.getElementById(tmp_id).setAttribute(&quot;class&quot;, &quot;thumb&quot;);
        }
        document.getElementById(obj).setAttribute(&quot;class&quot;, &quot;thumbclick&quot;);
        var ori_img = img_src.replace(&quot;thumb_&quot;, &quot;&quot;);
        document.getElementById(&quot;detimglink&quot;).setAttribute(&quot;href&quot;, ori_img);
    }
&lt;/script&gt;

&lt;!-- the view file --&gt;
&lt;div id=&quot;container&quot;&gt;
    &lt;div id=&quot;imgshow&quot;&gt;
        &lt;?php if (isset($images[0])) { ?&gt;
        &lt;a href=&quot;&lt;?php echo base_url().$dir['original'].$images[0]['original']; ?&gt;&quot; target=&quot;_blank&quot; id=&quot;detimglink&quot;&gt;
            &lt;img class=&quot;imgdet&quot; name=&quot;img_tag&quot; src=&quot;&lt;?php echo base_url().$dir['original'].$images[0]['original']; ?&gt;&quot; width=&quot;500&quot;/&gt;
        &lt;/a&gt;
        &lt;?php } ?&gt;
    &lt;/div&gt;

    &lt;div id=&quot;imglist&quot;&gt;
        &lt;form enctype=&quot;multipart/form-data&quot; id=&quot;fupload&quot; method=&quot;post&quot; action=&quot;&lt;?php echo site_url('image/'); ?&gt;&quot;&gt;
            &lt;input name=&quot;userfile&quot; type=&quot;file&quot; size=&quot;20&quot;/&gt;
            &lt;input type=&quot;submit&quot; name=&quot;btn_upload&quot; value=&quot;Upload &amp;uarr;&quot; class=&quot;btnupload&quot;/&gt;
            &lt;?php if (isset ($error)) { ?&gt;
            &lt;div class=&quot;error&quot;&gt;&lt;?php echo $error; ?&gt;&lt;/div&gt;
            &lt;?php } ?&gt;
        &lt;/form&gt;

        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;

        &lt;div class=&quot;imgfor&quot;&gt;
        &lt;!-- Looping Array Image --&gt;
        &lt;?php foreach($images as $key =&gt; $img) { ?&gt;
        &lt;div class=&quot;imgbox&quot;&gt;
            &lt;div&gt;
                &lt;a href=&quot;javascript:&quot; onclick=&quot;changepic('&lt;?php echo base_url().$dir['original'].$img['original']; ?&gt;', 'thumb_&lt;?php echo $key; ?&gt;');&quot;&gt;
                &lt;img class=&quot;thumb&quot; name=&quot;thumb&quot; id=&quot;thumb_&lt;?php echo $key; ?&gt;&quot; src=&quot;&lt;?php echo base_url().$dir['thumb'].$img['thumb']; ?&gt;&quot;/&gt;
                &lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;dadel&quot;&gt;
            &lt;a class=&quot;adel&quot; href=&quot;&lt;?php echo site_url('image/delete/'.$img['original']); ?&gt;&quot;&gt;
                delete
            &lt;/a&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;?php } ?&gt;
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;

        &lt;div class=&quot;bottom&quot;&gt;
            &lt;?php echo $total; ?&gt; Image(s)
        &lt;/div&gt;

        &lt;div class=&quot;bottom&quot;&gt;
            &lt;?php echo $this-&gt;pagination-&gt;create_links(); ?&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;

&lt;/div&gt; &lt;!-- end div container --&gt;
</pre>
<p>The result is like the image below, i&#8217;m not posting the css code in here but you can see on the demo (sorry, the upload and delete feature disabled) or the downloadable source code, and the code included some sample image so the size is bigger than fresh copy CodeIgniter.</p>
<p style="text-align: center;"><a href="http://superdit.com/wp-content/uploads/2010/06/CodeIgniter_Image_Gallery.png"><img class="size-full wp-image-1106   aligncenter" title="CodeIgniter_Image_Gallery" src="http://superdit.com/wp-content/uploads/2010/06/CodeIgniter_Image_Gallery.png" alt="" width="450" height="282" /></a></p>
<p style="text-align: center;"><a href="http://www.box.net/shared/ose6jkbhj8" target="_blank">DOWNLOAD SOURCE</a> | <a title="Basic Codeigniter Image Gallery" href="http://demo.superdit.com/ci_gallery/" target="_blank">DEMO</a></p>
<p style="text-align: left;"><em>in case the download link above not working try this: </em></p>
<p style="text-align: left;"><em><a href="http://www.box.net/shared/h1405cfukr" target="_blank">http://www.box.net/shared/h1405cfukr</a> or <a href="http://min.us/mveQ86i" target="_blank">http://min.us/mveQ86i</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/06/27/basic-image-gallery-with-codeigniter/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>

