<?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>ajaxBlender.com&#8212; MooTools Scripts. Custom MooTools Programming. MooTools Scripts Integration.</title>
	<atom:link href="http://www.ajaxblender.com/mootools/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxblender.com</link>
	<description>A Whole Lot of AJAX!</description>
	<lastBuildDate>Mon, 02 May 2011 07:38:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Resize Image Proportionally using JavaScript</title>
		<link>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html</link>
		<comments>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:20:01 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[image resize]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1023</guid>
		<description><![CDATA[We&#8217;re continuing a series of &#8220;How-to’s&#8221; for JavaScript beginners. In this tutorial we will explain how to proportionally resize images. Most tutorials that we have written utilize JavaScript platforms other than MooTools, so we decided to create this one using Mootools, however the function which will resize image&#8217;s size can be used with any framework [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re continuing a series of &#8220;How-to’s&#8221; for JavaScript beginners. In this tutorial we will explain how to proportionally resize images. Most tutorials that we have written utilize JavaScript platforms other than MooTools, so we decided to create this one using Mootools, however the function which will resize image&#8217;s size can be used with any framework (i.e. jQuery, ExtJS, script.aculo.us or just plain JavaScript.)<span id="more-1023"></span></p>
<p>We will just use an <strong>&lt;img /&gt;</strong> tag to resize the images. The actual task of resizing an image proportionally is quite simple, but the most important thing is to calculate the size properly. At first, you should define the size of the bounding box (the maximum size of your image). Let&#8217;s say it will be 200&#215;200 pixels:</p>
<p><img class="alignnone size-full wp-image-1033" title="bounding-box" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/bounding-box.gif" alt="bounding-box" width="235" height="235" /></p>
<p>And we have a photo with a size larger than the bounding box (size 500&#215;313 pixels):</p>
<p><img class="alignnone size-full wp-image-1025" title="sample-image" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/sample-image.jpg" alt="sample-image" width="500" height="313" /></p>
<p>After the image resize we should get something like this:</p>
<p><img class="alignnone size-full wp-image-1034" title="resized-image" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/resized-image.jpg" alt="resized-image" width="245" height="235" /></p>
<p>So that the width of the image will be 200 pixels and height will proportionally scale and become 125 pixels. The image will look smaller, but it keeps its proportions and will still look good.</p>
<p>Now let&#8217;s discuss how we will be implementing this in the code. Since we may want to reuse the code at some point in the future, it is best to create a function. First, it is smart to think of all the ways it could be used, how it will work, how you will call the function and also to determine input and output values. A little thought at this time will make the coding task simpler and ensure a more flexible product.</p>
<p>Input parameters of the function will be: <strong>maxW</strong>, <strong>maxH</strong> (these parameters will set the size of the bounding box) and <strong>currW</strong>, <strong>currH</strong> <em>(these parameters will contain current or original size of the image. In our sample it&#8217;s 500&#215;313 pixels)</em>. The function will calculate size and return an array containing two values. Usage of the function will be:</p>
<pre class="php">
<span class="phpKeyword">
var </span>newSize <span class="phpOperator">=</span> scaleSize<span class="phpOperator">(</span>200, 200, 500, 313<span class="phpOperator">)</span><span class="phpText">;</span>
alert<span class="phpOperator">(</span><span class="phpString">'New Width<span class="phpOperator">:</span> '</span> <span class="phpOperator">+</span> newSize<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span> <span class="phpOperator">+</span> <span class="phpString">', New Height<span class="phpOperator">:</span> '</span> <span class="phpOperator">+</span> newSize<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>Now let&#8217;s implement the algorithm of the <strong>scaleSize</strong> function. The logic is simple. You just determine the widest side <em>(for landscape photos it will be width and for portrait photos it will be height)</em>, then set the size of bounding box to it and calculate the size of the opposite side using the following formula:</p>
<p><strong>For width: </strong>currH / currH / currW;<br />
<strong>For height: </strong>currW * currH / currW;</p>
<p>You will notice that <strong>currH / currW</strong> expression repeats in both calculations. This is a ratio of height to width. So, here is the actual implementation of the function:<br />
<code></p>
<pre class="php">
<span class="phpFunctionKeyword">function</span> scaleSize<span class="phpOperator">(</span>maxW, maxH, currW, currH<span class="phpOperator">)</span><span class="phpOperator">{</span>
<span class="phpKeyword">
var </span>ratio <span class="phpOperator">=</span> currH / currW<span class="phpText">;</span>
<span class="phpKeyword">
if<span class="phpOperator">(</span></span>currW <span class="phpOperator">&gt;</span><span class="phpOperator">=</span> maxW &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> ratio <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> <span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
currW <span class="phpOperator">=</span> maxW<span class="phpText">;</span>
currH <span class="phpOperator">=</span> currW * ratio;
<span class="phpOperator">}</span><span class="phpKeyword"> else </span>>if<span class="phpOperator">(</span>currH <span class="phpOperator">&gt;</span><span class="phpOperator">=</span> maxH<span class="phpOperator">)</span><span class="phpOperator">{</span>
currH <span class="phpOperator">=</span> maxH<span class="phpText">;</span>
currW <span class="phpOperator">=</span> currH / ratio;
<span class="phpOperator">}</span>
<span class="phpKeyword">
return </span><span class="phpOperator">[</span>currW, currH<span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
</pre>
<p></code></p>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view the code in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1023&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>MooRTE</title>
		<link>http://www.ajaxblender.com/moorte.html</link>
		<comments>http://www.ajaxblender.com/moorte.html#comments</comments>
		<pubDate>Mon, 09 Nov 2009 13:07:31 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WYSIWYG editor]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1009</guid>
		<description><![CDATA[MooRTE is a rich text editor control using MooTools JavaScript framework. The script is light-weight, customizable and contains a lot of options for its skinning.
]]></description>
			<content:encoded><![CDATA[<p>MooRTE is a rich text editor control using MooTools JavaScript framework. The script is light-weight, customizable and contains a lot of options for its skinning.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1009&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/moorte.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BarackSlideshow</title>
		<link>http://www.ajaxblender.com/barackslideshow-mootools-slideshow-script.html</link>
		<comments>http://www.ajaxblender.com/barackslideshow-mootools-slideshow-script.html#comments</comments>
		<pubDate>Wed, 04 Nov 2009 18:27:15 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Slideshows]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=968</guid>
		<description><![CDATA[BarackSlideshow is a very tiny and lightweight slideshow script, that takes the power of MorphList to enhance visualization and navigation of the images.
]]></description>
			<content:encoded><![CDATA[<p>BarackSlideshow is a very tiny and lightweight slideshow script, that takes the power of MorphList to enhance visualization and navigation of the images.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=968&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/barackslideshow-mootools-slideshow-script.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>MooTools Tree Component</title>
		<link>http://www.ajaxblender.com/mootools-tree-component.html</link>
		<comments>http://www.ajaxblender.com/mootools-tree-component.html#comments</comments>
		<pubDate>Mon, 26 Oct 2009 18:30:56 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[tree]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=821</guid>
		<description><![CDATA[This script is a implementation of well-known treeview UI component using Mootools. This implementation includes drag-n-drop and nodes sorting functionality.
]]></description>
			<content:encoded><![CDATA[<p>This script is a implementation of well-known treeview UI component using Mootools. This implementation includes drag-n-drop and nodes sorting functionality.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=821&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/mootools-tree-component.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed Up Your MooTools: Selectors</title>
		<link>http://www.ajaxblender.com/speed-up-your-mootools-selectors.html</link>
		<comments>http://www.ajaxblender.com/speed-up-your-mootools-selectors.html#comments</comments>
		<pubDate>Mon, 26 Oct 2009 17:35:47 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=818</guid>
		<description><![CDATA[Read this tutorial to find out how to increase performance of your applications using selectors in Mootools.
]]></description>
			<content:encoded><![CDATA[<p>Read this tutorial to find out how to increase performance of your applications using selectors in Mootools.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=818&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/speed-up-your-mootools-selectors.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chaining Functions in Mootools for Dynamic Text Effects</title>
		<link>http://www.ajaxblender.com/chaining-functions-in-mootools-for-dynamic-text-effects.html</link>
		<comments>http://www.ajaxblender.com/chaining-functions-in-mootools-for-dynamic-text-effects.html#comments</comments>
		<pubDate>Mon, 26 Oct 2009 13:05:41 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[chainable transition effect]]></category>
		<category><![CDATA[visual effects]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=814</guid>
		<description><![CDATA[Dynamic text effects (fade ins, moving text, etc.) can enhance the viewer experience by directing attention to specific (and presumably important) areas of the page. From this tutorial you&#8217;ll learn how to use chaining functions in Mootools for Dynamic Text Effects.
]]></description>
			<content:encoded><![CDATA[<p>Dynamic text effects (fade ins, moving text, etc.) can enhance the viewer experience by directing attention to specific (and presumably important) areas of the page. From this tutorial you&#8217;ll learn how to use chaining functions in Mootools for Dynamic Text Effects.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=814&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/chaining-functions-in-mootools-for-dynamic-text-effects.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UvumiTools Gallery Plugin</title>
		<link>http://www.ajaxblender.com/uvumitools-gallery-plugin.html</link>
		<comments>http://www.ajaxblender.com/uvumitools-gallery-plugin.html#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:26:37 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Photo Galleries]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[photo gallery]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=727</guid>
		<description><![CDATA[The UvumiTools Gallery allows you to display fancy, search engine optimized photo galleries on your web site.
]]></description>
			<content:encoded><![CDATA[<p>The UvumiTools Gallery allows you to display fancy, search engine optimized photo galleries on your web site.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=727&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/uvumitools-gallery-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UvumiTools Dropdown Menu</title>
		<link>http://www.ajaxblender.com/uvumitools-dropdown-menu.html</link>
		<comments>http://www.ajaxblender.com/uvumitools-dropdown-menu.html#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:16:18 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Menu]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=722</guid>
		<description><![CDATA[This Mootools plugin provides a very simple multi-level menu built from an HTML unordered list. The plugin supports horizontal and vertical modes.
]]></description>
			<content:encoded><![CDATA[<p>This Mootools plugin provides a very simple multi-level menu built from an HTML unordered list. The plugin supports horizontal and vertical modes.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=722&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/uvumitools-dropdown-menu.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>UvumiTools DockMenu</title>
		<link>http://www.ajaxblender.com/uvumitools-dockmenu.html</link>
		<comments>http://www.ajaxblender.com/uvumitools-dockmenu.html#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:08:32 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Menu]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=717</guid>
		<description><![CDATA[The UvumiTools DockMenu for Mootools reproduces Mac OS dock in pure Javascript.The UvumiTools DockMenu for Mootools reproduces Mac OS dock in pure Javascript.
To see this plugin in action, click the &#8220;Demo&#8221; button and check out the bottom of your browser window: it&#8217;s a horizontal menu, with icons growing up when you hover them with your [...]]]></description>
			<content:encoded><![CDATA[<p>The UvumiTools DockMenu for Mootools reproduces Mac OS dock in pure Javascript.<span id="more-717"></span>The UvumiTools DockMenu for Mootools reproduces Mac OS dock in pure Javascript.</p>
<p>To see this plugin in action, click the &#8220;Demo&#8221; button and check out the bottom of your browser window: it&#8217;s a horizontal menu, with icons growing up when you hover them with your mouse. As you would expect from an UvumiTools plugin, the whole thing is degradable, built from standard HTML, and is cross-browser compatible.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=717&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/uvumitools-dockmenu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UvumiTools ColorSphere</title>
		<link>http://www.ajaxblender.com/uvumitools-colorsphere.html</link>
		<comments>http://www.ajaxblender.com/uvumitools-colorsphere.html#comments</comments>
		<pubDate>Thu, 08 Oct 2009 15:58:59 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[color picker]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=713</guid>
		<description><![CDATA[A nice-looking color picker Mootools script by UvumiTools lets casual users to choose a color easily, without spending too much time understanding how it works.
]]></description>
			<content:encoded><![CDATA[<p>A nice-looking color picker Mootools script by UvumiTools lets casual users to choose a color easily, without spending too much time understanding how it works.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=713&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/uvumitools-colorsphere.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

