<?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>alex.rabe &#187; memory limit</title>
	<atom:link href="http://alexrabe.de/tag/memory-limit/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexrabe.de</link>
	<description>ALEX RABE &#124; learning by doing...</description>
	<lastBuildDate>Mon, 09 Apr 2012 09:26:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Understand GD Library</title>
		<link>http://alexrabe.de/2008/05/13/understand-gd-library/</link>
		<comments>http://alexrabe.de/2008/05/13/understand-gd-library/#comments</comments>
		<pubDate>Tue, 13 May 2008 18:17:30 +0000</pubDate>
		<dc:creator>Alex Rabe</dc:creator>
				<category><![CDATA[Common]]></category>
		<category><![CDATA[NextGEN Gallery]]></category>
		<category><![CDATA[memory limit]]></category>
		<category><![CDATA[NextGEN-Gallery]]></category>

		<guid isPermaLink="false">http://alexrabe.de/2008/05/13/understand-gd-library/</guid>
		<description><![CDATA[In the forums I received very often the question :
I got the failure &#8220;Fatal error: Out of memory &#8221; or &#8220;Error : Exceed Memory limit. Require : xx.xx MByte&#8221;, but my image has only the size of 1 MB ?
After I answered this question now 1000 times , I hope this post will clarify this [...]]]></description>
			<content:encoded><![CDATA[<p>In the forums I received very often the question :</p>
<blockquote><p>I got the failure &#8220;Fatal error: Out of memory &#8221; or &#8220;Error : Exceed Memory limit. Require : xx.xx MByte&#8221;, but my image has only the size of 1 MB ?</p></blockquote>
<p>After I answered this question now 1000 times , I hope this post will clarify this point. Let&#8217;s create a white image with the size of 640 x 480 (It&#8217;s the VGA resolution) and open this with a image viewer like IrfanView.</p>
<p style="text-align: center"><a rel="lightbox" href="http://alexrabe.de/wp-content/uploads/white.jpg" title="White image"><img border="0" width="400" src="http://alexrabe.de/wp-content/uploads/white.jpg" alt="White image" /></a></p>
<p>Let&#8217;s have a look at the bottom line :</p>
<p style="text-align: center"><img src="http://alexrabe.de/wp-content/uploads/640x480.jpg" alt="640×480 Size" /></p>
<blockquote><p><em>The image requires a disk space (the file size) of 5.30 KB and a memory size of 900.04 KB</em></p></blockquote>
<p>Now increase the resolution to 1024 x 768 :</p>
<p style="text-align: center"><img src="http://alexrabe.de/wp-content/uploads/1024x768.jpg" alt="1024 Size" /></p>
<blockquote><p><em>The image requires still the file size of 5.30 KB but a memory size of 2.25 MB</em></p></blockquote>
<p>Now look for a 4 Megapixel image (Resolution 2304 x 1728) :</p>
<p style="text-align: center"><img src="http://alexrabe.de/wp-content/uploads/2304x1728.jpg" alt="4 MP Size" /></p>
<blockquote><p><em>The required memory size increases to 11.39 MB</em></p></blockquote>
<p>And a 7.1 MP camera picture :</p>
<p style="text-align: center"><img src="http://alexrabe.de/wp-content/uploads/3072x2304.jpg" alt="7.1 MP Size" /></p>
<blockquote><p><em>We need now 20.25 MB memory , but the file size is still 5.30 KB.</em></p></blockquote>
<p>What do we learn from this test ? JPG, PNG (and other compression format&#8217;s) reduces the file size, but for image manipulation we need for each pixel a lot of memory space:</p>
<blockquote><p><strong>File size is not equal to the required memory space</strong>.</p></blockquote>
<p>Inside the most web server the common image manipulation library for PHP is called <a href="http://www.libgd.org/">GD</a> and this library doesn&#8217;t work different then programs like Photoshop, Paintshop or others. A very rough calculation for the memory need under GD library is :</p>
<pre>Width x Height x 8 (bits) x 3(channels) / 8 x 1.65</pre>
<p>NextGEN Gallery shows you the current memory usage of WordPress and all loaded plugins inside the server settings :</p>
<p><img src="http://alexrabe.de/wp-content/uploads/nextgen21.jpg" alt="alexrabe" /></p>
<p>Now have a look at your <a href="http://alexrabe.de/2008/03/21/11-3/">Memory Limit</a> in the server settings and you can calculate the maximum resolution for your images, which you can manipulate (create thumbnails) with the GD library. It&#8217;s possible to change the memory limit, but there exist various way&#8217;s and not all of them are allowed at your web server. At the best contact your web hoster, if you want to increase this limit. A good and useful value for images is a limit of 64 MB.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexrabe.de/2008/05/13/understand-gd-library/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>

