<?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 Development Blog &#187; screenshot</title>
	<atom:link href="http://www.web-development-blog.com/archives/tag/screenshot/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-development-blog.com</link>
	<description>Web development tutorials, SEO articles and PHP script resources</description>
	<lastBuildDate>Sun, 25 Jul 2010 14:38:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Dynamic thumbnails from websites</title>
		<link>http://www.web-development-blog.com/archives/dynamic-thumbnails-from-websites/</link>
		<comments>http://www.web-development-blog.com/archives/dynamic-thumbnails-from-websites/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 14:30:10 +0000</pubDate>
		<dc:creator>Olaf</dc:creator>
				<category><![CDATA[PHP scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[girafa]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://www.web-development-blog.com/archives/dynamic-thumbnails-from-websites/</guid>
		<description><![CDATA[Since Alexa stopped offering their free thumbnail service last year a lot of thumbnail services are available now. Some of them offering limited free services and others only a paid premium version. On of the bigger and better services is Girafa, a thumbnail service with a free service and also premium services for users with [...]]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>Since Alexa stopped offering their free thumbnail service last year a lot of thumbnail services are available now. Some of them offering limited free services and others only a paid premium version. On of the bigger and better services is <a href="http://www.girafa.com/">Girafa</a>, a thumbnail service with a free service and also premium services for users with more then 2000 image requests a month.</p>
<p>Joining the service for free is fast and easy, within an hour my account was up and well. <span id="more-86"></span><br />
With a special Thumbnail URL Generator it&#8217;s possible to create the URL for a thumbnail from a website in no time, just enter the URL from the website and you get some code like this:</p>
<blockquote><p><strong>Client ID:</strong>	j35jh34k5j<br />
<strong> URL:</strong>	http://girafa.com<br />
<strong> Signature Key:</strong>	34u3gh45k4hk<br />
<strong> Concatenated String:</strong>	gh345gi6dfjhttp://girafa.com<br />
<strong> MD5 Hash:</strong>	d619bc0b9568adfe9f779359e3212f<br />
<strong> Signature:</strong>	9f7ce2e6e9e3212f<br />
<strong> Thumbnail URL:</strong> http://scst.srv.girafa.com/srv/i?i=j35j&#8230;&amp;r=http%3A%2F%2Fgirafa.com&amp;s=34&#8230;</p></blockquote>
<p>This information is OK if you add only a few thumbs to your homepage, but what if you need a dynamic function? The next function will do the job in PHP without using the thumbnail generator from the Girafa website.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$client_id</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'urrjr7894784'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// your client ID</span>
	<span style="color: #000088;">$signature</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'kjhh35h4j5'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// the signature you entered @ girafa</span>
	<span style="color: #000088;">$concatenated</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$signature</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$MD5_Hash</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$concatenated</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$signature</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$MD5_Hash</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://scst.srv.girafa.com/srv/i?i='</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$str</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$client_id</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;amp;r='</span><span style="color: #339933;">.</span> <span style="color: #000088;">$url</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;amp;s='</span><span style="color: #339933;">.</span> <span style="color: #000088;">$signature</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$str</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This function returns a complete URL based on the argument you have passed to the function.</p>
<p><strong>How does it work?</strong><br />
First the signature you entered via the Girafa website is concatenated to the URL, on the next code row there is a MD5 hash created from the string (signature+url). With the PHP function <strong>substring</strong> the string is shortened into the last 16 characters and this new string is used as a value for the variable <strong>$signature</strong>. Next you need to <strong>urlencode</strong> the URL and at the end the function returns a string with all required values. The result is a same type of URL which is created with the thumbnail generator from the Girafa website.</p>
<p><strong>What if 2000 thumbnail requests are not enough?</strong><br />
First of all you can buy as much as thumbnails you need. If you don&#8217;t have a budget for this premium service, it&#8217;s possible to cache the thumbnails on your own web server with this kind of code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dom_parts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">parse_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$thumb</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'doc_root/your_thumb/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$dom_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.jpg'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!@</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thumb</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// next you will use your function</span>
	<span style="color: #000088;">$request_for</span> <span style="color: #339933;">=</span> thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #339933;">@</span><span style="color: #990000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request_for</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thumb</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Check this <a href="http://www.siteranks.net/" title="check your websites siterank">website</a> to get an idea how you can use it. </strong><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.web-development-blog.com/archives/search-for-photos-using-php-and-the-flickr-api/" rel="bookmark" title="December 19, 2009">Search for photos using PHP and the flickr API</a></li>
<li><a href="http://www.web-development-blog.com/archives/create-custom-recaptcha-images-using-their-api/" rel="bookmark" title="December 7, 2009">Create custom reCAPTCHA images using their API</a></li>
<li><a href="http://www.web-development-blog.com/archives/is-your-website-is-down-know-before-your-visitors-do/" rel="bookmark" title="August 22, 2008">Is your website is down? Know before your visitors do!</a></li>
</ul>
<p><!-- Similar Posts took 3.519 ms --></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.web-development-blog.com/archives/dynamic-thumbnails-from-websites/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->