<?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>Web Cash &#187; image</title>
	<atom:link href="http://www.earn-web-cash.com/tag/image/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.earn-web-cash.com</link>
	<description>Writing, Designing, and Making Money Online</description>
	<lastBuildDate>Sun, 04 Dec 2011 22:52:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>How to Enable Client-Side Caching of Resized Images</title>
		<link>http://www.earn-web-cash.com/2008/03/01/php-cache-resized-images/</link>
		<comments>http://www.earn-web-cash.com/2008/03/01/php-cache-resized-images/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 00:37:44 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[resize]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/03/01/php-cache-resized-images/</guid>
		<description><![CDATA[About a month ago, I wrote a tutorial on dynamically resizing images in PHP. Despite my best intentions, I never found the time to go back and rewrite the script to include server-side caching of the images created. However, one reader asked if it was possible to enable a client-side cache of a dynamically resized [...]]]></description>
			<content:encoded><![CDATA[<p>About a month ago, I wrote a tutorial on <a href="http://www.earn-web-cash.com/2008/01/30/resize-images-php/">dynamically resizing images in PHP</a>.  Despite my best intentions, I never found the time to go back and rewrite the script to include server-side caching of the images created.</p>
<p>However, one reader asked if it was possible to enable a client-side cache of a dynamically resized image.  It surely is, and it&#8217;s very simple.<br />
<span id="more-166"></span></p>
<h4>Dynamic Image Resizing: Revisited</h4>
<p>If you&#8217;ve got no clue how to resize an image in PHP, then you ought to go back and re-read the <a href="http://www.earn-web-cash.com/2008/01/30/resize-images-php/">original article</a>.  For the rest of you, here&#8217;s a quick refresher on what happens.</p>
<p>Our script takes a filename as a $_GET parameter.  If the file exists, the script loads it in as an image resource.  Using the GD library, we create a new image resource that is the proper size.</p>
<p>Finally, we use a content-type header to tell the browser to interpret the data as an image and we output the image data.  Like this&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Enabling a Client Side Cache</h4>
<p>In order to enable a client-side cache, all we need to do is add an extra header to the mix.</p>
<p>There is a set of headers in HTTP to handle this sort of need &#8211; Cache-Control.  You can use this to enable caching, disable caching, and set some restrictions on what can be cached for how long.</p>
<p>The option we&#8217;re most interested in is max-age=[seconds].  This response header is sent along with the data to tell the browser that it can re-use a cached copy as long as it is no older than the specified age.</p>
<p>To enable this with PHP, add another header() call before the imagepng() call, and set a Cache-Control header with an appropriate max-age.  Like so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: max-age=3600&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Keep Request Queries Consistent</h4>
<p>With this system, you could set a pretty long max-age for the cache.  Assuming that the original image never changes, the user could cache a resized copy for months and your script would be happy.</p>
<p>However, you need to keep your query strings consistent for this to work.  Since your request includes a query string, that full string is included in the location that is cached.</p>
<p>According to your browser, it&#8217;s not the image that is cached, it&#8217;s the location&#8230;</p>
<pre>http://www.earn-web-cash.com/scripts/resize-image.php?image=http://www.earn-web-cash.com/wp-content/uploads/2008/01/dzone-screenshot.png</pre>
<p>If you were to change the query string in any way &#8211; leaving out the www, for example &#8211; the browser will think it is fetching a new resource and it won&#8217;t consult the cache.</p>
<p>This is especially important if you include size parameters in the query string to dynamically choose the new size.  You would need to be careful to keep the parameters in the same order every time for the cache to work properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/03/01/php-cache-resized-images/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How to Use PHP To Dynamically Resize an Image</title>
		<link>http://www.earn-web-cash.com/2008/01/30/resize-images-php/</link>
		<comments>http://www.earn-web-cash.com/2008/01/30/resize-images-php/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 01:26:57 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/01/30/resize-images-php/</guid>
		<description><![CDATA[One of the most annoying things about working with images is getting them into the right size. Screenshots start out huge &#8211; and you need to resize them to an appropriate size for your website. Some blogs automatically resize the pictures for you into a thumbnail &#8211; like the image to the right. What if [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/dzone-screenshot.png' title='Screenshot of a Dzone Page'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/dzone-screenshot.thumbnail.png' alt='Screenshot of a Dzone Page' /></a>One of the most annoying things about working with images is getting them into the right size.  Screenshots start out huge &#8211; and you need to resize them to an appropriate size for your website.</p>
<p>Some blogs automatically resize the pictures for you into a thumbnail &#8211; like the image to the right.  What if you want the image a different size, though?  You could allow the browser to resize it for you, or &#8211; better yet &#8211; write your own php script to resize the image dynamically.<br />
<span id="more-87"></span></p>
<h5>Why You Shouldn&#8217;t Let the Browser Resize Images</h5>
<p><img src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/dzone-screenshot.png' class='alignright' style='width: 200px; height: 150px'; />Look at the original picture &#8211; the small thumbnail created by WordPress.  Notice how large it is &#8211; 13.9kb.  When WordPress resizes the image, it also reduces the file size.  If I were to include the fullsize image and resize it using css height and width attributes, the file size would <strong>not</strong> be cut down.  </p>
<p>Want proof?  Look at the second image to the right &#8211; that&#8217;s simply resized by the browser.  It&#8217;s a whopping 284.21kb.</p>
<p><img src='/scripts/resize-image.php?image=http://www.earn-web-cash.com/wp-content/uploads/2008/01/dzone-screenshot.png' class='alignright' />If we write our own php script to resize the image dynamically, we can control both the image size <strong>and</strong> the file size.  Check out the third image to the right &#8211; which was resized with a php script.  You&#8217;ll notice that it looks nicer too &#8211; the browser isn&#8217;t designed to resize images.</p>
<h5>Using the PHP GD Library to Resize the Image</h5>
<p>So how do we do this?  We&#8217;re going to make use of the PHP GD library to manipulate the image, and a $_GET parameter to tell it which image to re-size.</p>
<p>Let&#8217;s walk through using the GD library to re-size an image.  Then we&#8217;ll see how to include that in your HTML to actually do the resizing for you.</p>
<p>First, we need to open up the original file and get it&#8217;s size and type characteristics.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$src_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'image.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$srcsize</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'image.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><code>imagecreatfrompng()</code> creates an image object and stores it in $src_image.  If the file was a different type we could replace &#8220;png&#8221; with &#8220;jpeg&#8221; or &#8220;gif.&#8221;  <code>getimagesize()</code> stores an array in $srcsize that contains the width of the image ($srcsize[0]), the height of the image ($srcsize[1]), and the filetype of the image ($srcsize[2]).</p>
<p>Now we need to create new dimensions for the new image and actually create an image.  We&#8217;ll resize it to 200 pixels wide &#8211; and then adjust the height to maintain the ratio.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dest_x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dest_y</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dst_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatetruecolor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dest_x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest_y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The calculations should be self explanatory.  <code>imagecreatetruecolor()</code> creates a new image object for us with the given dimensions &#8211; which we will soon fill in with our resized image.</p>
<p>The next step is to place the resized image into <code>$dst_img</code> and output the image as Image content.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">imagecopyresampled</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #339933;">,</span> <span style="color: #000088;">$src_img</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$dest_x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest_y</span><span style="color: #339933;">,</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><code>imagecopyresampled()</code> copies an image ($dst_img) into a new image ($src_img) with a set of given attributes (including our sizes).  The &#8220;Header&#8221; line tells the browser that this is an image &#8211; so that it&#8217;s not displayed as a bunch of gibberish.  Finally, the <code>imagepng()</code> function actually displays the image.</p>
<p>Now, we need to clean up and destroy the image objects.  Otherwise, we could end up sapping a lot of memory from the server.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h5>Displaying the Script in HTML</h5>
<p>If you load the script directly, you should simply see the image.  It creates an image resource and displays it in the browser &#8211; as if &#8220;resize-image.php&#8221; was really &#8220;image.png.&#8221;</p>
<p>Therefore all we need to do to include this new image in an HTML page is use the php script as the <code>src</code> attribute of our <code>&lt;img&gt;</code> tag.  Like so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'resize-image.php'</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>The script will execute, create an image, and use that as the <code>src</code>.</p>
<p>The last thing we need to do is modify our script so that we can pass it some information.  </p>
<p>It wouldn&#8217;t do much good if we had to write a new php script for every image we wanted to resize.  Instead, we can use the $_GET array to send a variable (the image filename) to our image resizing script.</p>
<p>Here&#8217;s the entire image resizing script, with the $_GET variable used for the filename.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//  Create source image and dimensions</span>
<span style="color: #000088;">$src_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$srcsize</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dest_x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dest_y</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dst_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatetruecolor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dest_x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest_y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  Resize image</span>
<span style="color: #990000;">imagecopyresampled</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #339933;">,</span> <span style="color: #000088;">$src_img</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest_x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest_y</span><span style="color: #339933;">,</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$srcsize</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  Output image</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  Destroy images</span>
<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dst_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To use this, you need to slightly modify your HTML and add an &#8220;image&#8221; parameter to the URL of your script.  Like so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'resize-image.php?image=image.png'</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>There ya go!  Now you can resize images on the fly.</p>
<h5>Next Steps to Take&#8230;</h5>
<p>This is of course a basic introduction to the topic.  You can add a lot of functionality to resize-image.php.</p>
<p>For example, you could take extra parameters &#8211; like a width and/or height.  You might also want to include a bunch of error checking &#8211; make sure the file exists, make sure the new dimensions are appropriate, etc.  </p>
<p>You could also use a <code>switch()</code> statement to open different types of images &#8211; based on the contents of $srcsize[2].  Remember, you can use the GD library to do more than work with .png files.  By replacing &#8216;png&#8217; with &#8216;jpeg&#8217; or &#8216;gif&#8217; you can use the same functions to work with these file types.  For example, <code>imagecreatefromjpeg</code> is equivalent to <code>imagecreatefrompng</code>.</p>
<p>In the near future, I plan on extending this example into a full-fledged script for immediate download and use.  So stay tuned &#8211; and leave any comments with suggestions for what the script should be able to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/01/30/resize-images-php/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the Best Choice, Combination, and Placement of Adsense Ads?</title>
		<link>http://www.earn-web-cash.com/2008/01/29/adsense-trends/</link>
		<comments>http://www.earn-web-cash.com/2008/01/29/adsense-trends/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 21:40:56 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[Advertising]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[AdSense]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[earnings]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/01/29/adsense-trends/</guid>
		<description><![CDATA[<p>If you operate a website (like this blog), Google Adsense is probably one of your main streams of revenue.  Although you may eventually outgrow Adsense, chances are you'll have used it at some point.</p>

<p>While looking through my Adsense stats, I noticed an odd trend.  This trend suggested a few things about monetizing a site through Adsense - questions that I don't have an answer for yet, but that I will be looking for.</p>]]></description>
			<content:encoded><![CDATA[<div class="alignright"><script type="text/javascript"><!--
google_ad_client = "pub-2399151883698113";
//125x125 Adsense Referral Button
google_ad_slot = "1937689390";
google_ad_width = 125;
google_ad_height = 125;
google_cpa_choice = ""; // on file
//--></script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>If you operate a website (like this blog), Google Adsense is probably one of your main streams of revenue.  Although you may eventually outgrow Adsense, chances are you&#8217;ll have used it at some point.</p>
<p>While looking through my Adsense stats, I noticed an odd trend.  This trend suggested a few things about monetizing a site through Adsense &#8211; questions that I don&#8217;t have an answer for yet, but that I will be looking for.</p>
<p><span id="more-85"></span></p>
<p>On this and my other site (<a href="http://www.teachbabel.com" title="Babel - Bringing Teachers Together">Babel</a>), I use a few main types of ads &#8211; a horizontal image banner, a skyscraper with text and images, and square boxes with text and images.</p>
<p>It&#8217;s natural to wonder, &#8220;Which ad is the most efficient and most effective?&#8221;</p>
<p>Both of these sites are relatively new, so I don&#8217;t have a lot of data to work with.  From the data that I do have, though, I&#8217;ve noticed a few key trends.</p>
<ul>
<li>The tall vertical skyscraper and the square blocks seem to have the best click-through rate</li>
<li>The horizontal image banner (like the one in the header) seems to have a low click-through rate</li>
<li>The tall vertical skyscraper and the square blocks seem to have lower pay-per-click values</li>
<li>The horizontal image banner seems to have a much higher payout than the other two options</li>
</ul>
<p>Like I said, I don&#8217;t have a whole lot of data to support these trends at the moment.  Over the next month or two, I plan on watching these trends and testing them out (using random tests of text verse image ads).</p>
<p>It&#8217;s something to keep in mind, though.  The horizontal image banner seems to be the most effective &#8211; the high payout makes up for the low click-through rate.  Although I wouldn&#8217;t get rid of the other ads, it&#8217;s a good justification for making sure you have at least one horizontal image banner on your site.</p>
<p>Notice any trends in your own Adsense reports?  I&#8217;d be interested to hear what other people have come up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/01/29/adsense-trends/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Create a Gradient Background Image in GIMP</title>
		<link>http://www.earn-web-cash.com/2008/01/24/how-to-create-a-gradient-background-image-in-gimp/</link>
		<comments>http://www.earn-web-cash.com/2008/01/24/how-to-create-a-gradient-background-image-in-gimp/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 21:59:18 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[GIMP Tutorial]]></category>
		<category><![CDATA[HTML Tutorials]]></category>
		<category><![CDATA[Redirected]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/01/24/how-to-create-a-gradient-background-image-in-gimp/</guid>
		<description><![CDATA[The other day I wrote about how to add a gradient background to a css tooltip. So I thought it might be a good idea to walk through how to create the actual gradient image. Since I recently switched to Ubuntu Linux, I don&#8217;t use Photoshop anymore. GIMP all the way. So this tutorial will [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/gradient.png' title='Sample Gradient Background'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/gradient.thumbnail.png' alt='Sample Gradient Background' /></a>The other day I wrote about how to <a href="http://www.earn-web-cash.com/2008/01/21/tooltip-gradient/" title="Add a gradient background to a tooltip">add a gradient background to a css tooltip</a>.  So I thought it might be a good idea to walk through how to create the actual gradient image.</p>
<p>Since I recently switched to Ubuntu Linux, I don&#8217;t use Photoshop anymore.  GIMP all the way.  So this tutorial will show you briefly how to create a gradient image in GIMP and then use it as the background of an html element.<br />
<span id="more-60"></span></p>
<h5>Create a Blank Image (120px x 120px)</h5>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/blank-image.jpg' title='Gradient Background Tutorial - Blank Image (Step 1)'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/blank-image.thumbnail.jpg' alt='Gradient Background Tutorial - Blank Image (Step 1)' /></a>First thing &#8211; fire up GIMP and create a new image.  Usually a gradient background image is 1 pixel wide.  For now we&#8217;ll create a bigger image so it&#8217;s easier to see what we&#8217;re doing &#8211; 120 pixels by 120 pixels.  You can crop the image down to a 1 pixel width later.</p>
<h5>Set the Foreground and Background Colors</h5>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/color-chooser.jpg' title='Gradient Background Tutorial - Color Chooser (Step 2)'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/color-chooser.thumbnail.jpg' alt='Gradient Background Tutorial - Color Chooser (Step 2)' /></a>When you create a gradient, you need to set two colors &#8211; the beginning color (usually the foreground) and the ending color (usually the background color).  To change these colors, click on the square swatch of the foreground color in your toolbar (see the circled area in the screenshot to the right).</p>
<p>This should bring up a box titled, &#8220;Change Foreground Color.&#8221;  Pick a dark color &#8211; I used #981313.  Then, click on the Background Color Swatch (the one right behind the Foreground color).  Change the background color to a lighter version of your foreground color &#8211; I used #f17b7b.</p>
<h5>Select the Gradient Tool</h5>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/gradient-tool.jpg' title='Gradient Background Tutorial - Gradient Tool (Step 3)'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/gradient-tool.thumbnail.jpg' alt='Gradient Background Tutorial - Gradient Tool (Step 3)' /></a>Now that you&#8217;ve chosen the two colors, you&#8217;re ready to create the gradient.  Click on the &#8220;Gradient&#8221; tool &#8211; it&#8217;s the square that fades from black to light gray.  See the screenshot to the right.  There are a bunch of options you could customize, but for a standard gradient background image you&#8217;re better off leaving them alone.</p>
<h5>Draw the Gradient!  Then Crop Away</h5>
<p><a href='http://www.earn-web-cash.com/wp-content/uploads/2008/01/dragging-gradient.jpg' title='Gradient Background Tutorial - Drawing the Gradient (Step 4)'><img class="alignright" src='http://www.earn-web-cash.com/wp-content/uploads/2008/01/dragging-gradient.thumbnail.jpg' alt='Gradient Background Tutorial - Drawing the Gradient (Step 4)' /></a>Now you can actually create the gradient by clicking and dragging on your image canvas.  Position the tool at the top border of your canvas (if you look in the bottom left, it&#8217;ll tell you when you&#8217;re over pixel &#8220;0&#8243;).  Hold down the Control button to force GIMP to draw a straight line, and drag the cursor down to the bottom pixel of your canvas.</p>
<p>Let go.  Voila!  You&#8217;ve got a nice gradient image created.</p>
<p>You could use it as-is in your css stylesheet, but it&#8217;s usually a good idea to trim your picture to 1px wide.  The browser can simply repeat the image across the entire width of the element &#8211; so making it wider than 1 px is simply wasting bandwidth.  Go ahead and crop the image now, and in the future make your gradient images 1 px wide by whatever height you want.</p>
<p>Now, let&#8217;s write the css to use this as a background image for an html element.</p>
<pre><code>.gradient {
  background: #f17b7b url(images/gradient.png)
    repeat-x top; }</code></pre>
<p>There&#8217;s four pieces to this shorthand css declaration.</p>
<ul>
<li><code>#f17b7b</code> sets the background color.  This is the same as the bottom color in our gradient, so that if the container is taller than the gradient image it seems to blend smoothly.</li>
<li><code>url(images/gradient.png)</code> sets our gradient image as the background image.  Make sure you change the path to where-ever you uploaded your gradient image.</li>
<li><code>repeat-x</code> tells the browser to repeat the image left-to-right for the entire width of the container.  This is what makes our 1-pixel background image &#8220;stretch&#8221; across the entire width.</li>
<li><code>top</code> simply tells the background image to align itself to the top edge of the container.  Not always necessary, but your better safe than sorry.</li>
</ul>
<p>And that&#8217;s all there is to it.  Create an html element with class <code>gradient</code> and it should have your lovely gradient background.</p>
<p>So get to it.  Start drawing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/01/24/how-to-create-a-gradient-background-image-in-gimp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Add a Gradient Background to a CSS Tooltip</title>
		<link>http://www.earn-web-cash.com/2008/01/21/tooltip-gradient/</link>
		<comments>http://www.earn-web-cash.com/2008/01/21/tooltip-gradient/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 02:13:18 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[HTML Tutorials]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[tooltip]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/01/21/tooltip-gradient/</guid>
		<description><![CDATA[In an earlier post, we learned how to create a tooltipKind of like this boring, gray tooltip. using CSS. I walked you through the mechanics of creating the tooltip and left the actual css styling up to you. Today, we&#8217;ll take a look at how to make this tooltip look a bit nicer &#8211; using [...]]]></description>
			<content:encoded><![CDATA[<p>In an <a href="http://www.earn-web-cash.com/2008/01/19/create-css-tooltips/">earlier post</a>, we learned how to create a <a class="tooltip">tooltip<span>Kind of like this boring, gray tooltip.</span></a> using CSS.  I walked you through the mechanics of creating the tooltip and left the actual css styling up to you.</p>

<p>Today, we&#8217;ll take a look at how to make this tooltip look a bit nicer &#8211; using a gradient background and some extra styling.</p>
<span id="more-56"></span>
<p>To review, here&#8217;s the basic styling to create the tooltip.  Refer to the <a href="http://www.earn-web-cash.com/2008/01/19/create-css-tooltips/">original post for an explanation of the CSS/HTML</a>.</p>

<pre><code>a.info span {
    display: none; }

a.info:hover {
    position: relative; }

a.info:hover span {
    display: block;
    position: absolute;
    top: 0;
    left: 0; }
</code></pre>

<p>In order to make this look a bit nicer, kind of like <a class="tooltip">this tooltip<span class="gradient">This tooltip has a gradient background, some bold-face font, and a nice border on top and bottom.</span></a>, we&#8217;re going have to add some more style to <code>a.info:hover span</code>.</p>

<p>First, let&#8217;s change the colors a bit, add a nicer border, add some padding, and move the tooltip down about one line.</p>

<pre><code>a.info hover span {
   top: 1.5em;
   padding: 1em;
   border-top: 3px solid #d58700;
   border-bottom: 3px solid #d58700;
   border-left: none;
   border-right: none;
   color: white;
   background: #516898; }</code></pre>

<p>Adding that styling would leave us with <a class="tooltip">this tooltip<span class="gradient" style="background: #516898;">This looks a lot nicer, but we still need a gradient background.</span></a>.</p>

<p>I created a <a href="http://www.earn-web-cash.com/wp-content/themes/webcash/images/tooltip-gradient.png" alt="Gradient image for the background of the tooltip">gradient image</a> in GIMP.  You should be able to do this in your favorite image editing program.</p>

<p>I made the gradient image 120px tall.  I figured that&#8217;s high enough for the average tooltip, and longer ones will be covered by the standard background color.  This background color should be the same as the bottom color of the gradient.  That way when the gradient ends&#8230; it blends in nicely.</p>

<p>To add the gradient, we&#8217;ll change one line in the css declaration for <code>a.info:hover span</code> &#8211; the <code>background</code> line.</p>

<pre><code>background: #516898 url
  (images/tooltip-gradient.png) repeat-x top;</code></pre>

<p>Now we&#8217;ve got our <a class="tooltip">final tooltip<span class="gradient">This should be nicely styled.  Looks good to me anyway.</span></a>.</p>

<p>You&#8217;ll notice a few things in the <code>background</code> declaration &#8211; and these hold true for any time you use a gradient background.  I included a color &#8211; which is equal to the bottom end of the gradient.  This way it can blend in if the tooltip becomes longer than the gradient image.</p>

<p>I included <code>repeat-x</code> &#8211; which means that the gradient image will be repeated every 1 px along the x-axis.  This let&#8217;s you expand the image to the full width of the block, but only have to load a nicely small 1px wide image.  I also included <code>top</code> to make sure that the gradient appears all the way to the top of the tooltip&#8217;s box.</p>

<p>Well there you have it.  Once you get the mechanics of the tooltip down, it&#8217;s pretty simple to add extra styling like a gradient background image.  All you need to do is create your own gradient and tailor the colors to your own needs.</p>

<p>Happy tool-tipping.</p>]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/01/21/tooltip-gradient/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why Don&#8217;t My Images Appear in My HTML E-mail?</title>
		<link>http://www.earn-web-cash.com/2008/01/16/why-dont-my-images-appear-in-my-html-e-mail/</link>
		<comments>http://www.earn-web-cash.com/2008/01/16/why-dont-my-images-appear-in-my-html-e-mail/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 22:33:55 +0000</pubDate>
		<dc:creator>Walkere</dc:creator>
				<category><![CDATA[HTML Tutorials]]></category>
		<category><![CDATA[Redirected]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[link]]></category>

		<guid isPermaLink="false">http://www.earn-web-cash.com/2008/01/16/why-dont-my-images-appear-in-my-html-e-mail/</guid>
		<description><![CDATA[I was browsing around the PHP forum on Daniweb and came across this problem in a post. Here&#8217;s the situation. The guy wanted to send out a newsletter, so he grabbed a pre-fabbed newsletter script. The PHP script seemed to work fine &#8211; it read an HTML template and then fired off the e-mail in [...]]]></description>
			<content:encoded><![CDATA[<p>I was browsing around the PHP forum on Daniweb and came across <a href="http://www.daniweb.com/forums/thread104769.html">this problem in a post</a>.</p>
<p>Here&#8217;s the situation.</p>
<p>The guy wanted to send out a newsletter, so he grabbed a pre-fabbed newsletter script.  The PHP script seemed to work fine &#8211; it read an HTML template and then fired off the e-mail in HTML form.</p>
<p>There was just one problem: none of the images were appearing in the HTML e-mail when he tried to view it.<br />
<span id="more-41"></span><br />
What was the culprit?  The PHP script?  Or simply some faulty HTML?</p>
<p>It turns out the PHP script was working just as intended.  If you view his post, you can get a copy of the source code.  I haven&#8217;t tested it, but he claims it worked fine.</p>
<p>The problem was a simple mistake in HTML coding.</p>
<p>When the img tags were declared, the src attribute was set with a <strong>relative url</strong>  instead of an <strong>absolute url</strong>.</p>
<p>What&#8217;s the difference?</p>
<p>A <strong>relative url</strong> tells the browser the path to a file from the current file&#8217;s directory location.  So, for example, let&#8217;s say I have a file &#8220;index.html&#8221; and a file &#8220;guide.html&#8221; inside the directory &#8220;web-design-guides&#8221; on the domain &#8220;http://www.earn-web-cash.com.&#8221;</p>
<p>If I want to create a link from &#8220;index.html&#8221; to &#8220;guide.html&#8221; using a relative url, I simply use this tag&#8230;</p>
<p><code>
<pre>&lt;a href="guide.html"&gt;Guide.html&lt;/a&gt;</pre>
<p></code></p>
<p>That tells the browser to look inside the same directory for the file &#8220;guide.html.&#8221;</p>
<p>A <strong>absolute url</strong> defines the absolute path to a file.  In the same example, we&#8217;d have to include in the href the domain, the directory, and the file name, like so&#8230;</p>
<p><code>
<pre>&lt;a href="http://www.earn-web-cash.com/
  web-design-guides/guide.html"&gt;Guide.html&lt;/a&gt;</pre>
<p></code></p>
<p>The advantage of relative URLs is that they&#8217;re quick to type and they make webpages easily portable.  If all of my links are relative and I move the entire site to a new server, I don&#8217;t have to edit anything.</p>
<p>If I had used absolute urls, I would have had to change the domain name in every anchor tag.  The advantage of absolute urls, though, is that they can be accessed no matter where the page is accessed.</p>
<p>So, for example, if I turn the webpage into an e-mail (or if it&#8217;s read in an rss reader), the absolute url is still valid.  If I use a relative url in an html e-mail, the reader&#8217;s browser won&#8217;t be able to find the file &#8211; it will look in the directory that the e-mail script is running to find the file you&#8217;re linking to.</p>
<p>So what&#8217;s the lesson here?</p>
<p>If you&#8217;re writing HTML that is going to be displayed somewhere <strong>other</strong> than your server &#8211; i.e. in an e-mail, cached on someone&#8217;s hard drive, or on an rss reader &#8211; remember to always use absolute urls.</p>
<p>This is especially important for <code>&lt;img&gt;</code> tags &#8211; because they are almost always declared in regular pages as relative urls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.earn-web-cash.com/2008/01/16/why-dont-my-images-appear-in-my-html-e-mail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

