<?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>AjaxMasters Blog &#187; html</title> <atom:link href="http://blog.ajaxmasters.com/tag/html/feed/" rel="self" type="application/rss+xml" /><link>http://blog.ajaxmasters.com</link> <description>Just another WordPress weblog</description> <lastBuildDate>Fri, 27 Jan 2012 15:44:56 +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>Themes Masters &#8211; Our new addition. (free themes)</title><link>http://blog.ajaxmasters.com/themes-masters-our-new-addition-free-themes/</link> <comments>http://blog.ajaxmasters.com/themes-masters-our-new-addition-free-themes/#comments</comments> <pubDate>Tue, 12 Apr 2011 19:12:43 +0000</pubDate> <dc:creator>Chocksy</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[ajaxmasters]]></category> <category><![CDATA[free]]></category> <category><![CDATA[html]]></category> <category><![CDATA[masters]]></category> <category><![CDATA[psd]]></category> <category><![CDATA[template]]></category> <category><![CDATA[themes]]></category> <category><![CDATA[themesmasters]]></category><guid
isPermaLink="false">http://blog.ajaxmasters.com/?p=409</guid> <description><![CDATA[Hello Guys. We just launched a new website called Themes Masters. Right now is a simple one page website with a gallery of stuff we offer for free. If you are interested go ahead and check it out. Depending on the interest we see from you guys we will get...]]></description> <content:encoded><![CDATA[<p>Hello Guys.</p><p>We just launched a new website called <a
href="http://themesmasters.com" target="_blank">Themes Masters</a>. Right now is a simple one page website with a gallery of stuff we offer for free. If you are interested go ahead and check it out. Depending on the interest we see from you guys we will get this website bigger.</p><p>Also if you are a designer but you lack in code skills we have a proposition for a collaboration with you so just go on there and leave us 2 lines or email us at: <a
href="mailto:info@ajaxmasters.com">info@ajaxmasters.com</a></p><p>Down here are 2 themes you can download for free. One is a PSD template and another one is a HTML template:</p><div
id="attachment_413" class="wp-caption aligncenter" style="width: 600px"><a
href="http://blog.ajaxmasters.com/2011/04/12/themes-masters-our-new-addition-free-themes/01_preview-2/" rel="attachment wp-att-413"><img
class="size-full wp-image-413" title="Simple Blog - HTML template" src="http://blog.ajaxmasters.com/wp-content/uploads/2010/10/01_preview1.jpg" alt="Simple Blog - HTML template" width="590" height="300" /></a><p
class="wp-caption-text">Simple Blog - HTML template</p></div><div
id="attachment_412" class="wp-caption aligncenter" style="width: 600px"><a
href="http://themesmasters.com/preview/light-my-way/"><img
class="size-full wp-image-412" title="Light My Way - PSD template" src="http://blog.ajaxmasters.com/wp-content/uploads/2010/10/01_preview.jpg" alt="Light My Way - PSD template" width="590" height="300" /></a><p
class="wp-caption-text">Light My Way - PSD template</p></div><p>We&#8217;ll keep you posted with new stuff we come up with here on the blog too so if you have any suggestions don&#8217;t hesitate to leave us a comment we will respond for sure.</p><h2>ThemesMasters.com Website</h2><div
id="attachment_418" class="wp-caption aligncenter" style="width: 600px"><a
href="http://themesmasters.com"><img
class="size-full wp-image-418" title="Themes Masters - Website" src="http://blog.ajaxmasters.com/wp-content/uploads/2010/10/simple-logo.jpg" alt="Themes Masters - Website" width="590" height="242" /></a><p
class="wp-caption-text">Themes Masters - Website</p></div> ]]></content:encoded> <wfw:commentRss>http://blog.ajaxmasters.com/themes-masters-our-new-addition-free-themes/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Use ajax to create a cacheing system</title><link>http://blog.ajaxmasters.com/use-ajax-to-create-a-cacheing-system/</link> <comments>http://blog.ajaxmasters.com/use-ajax-to-create-a-cacheing-system/#comments</comments> <pubDate>Tue, 29 Sep 2009 10:49:52 +0000</pubDate> <dc:creator>Chocksy</dc:creator> <category><![CDATA[Tutorial]]></category> <category><![CDATA[cache]]></category> <category><![CDATA[html]]></category> <category><![CDATA[imageroll]]></category> <category><![CDATA[images]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[php]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[system]]></category> <category><![CDATA[vi.sualize.us]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://blog.ajaxmasters.com/?p=163</guid> <description><![CDATA[<p>As I said in my last post, I wanted from the first time to make a cacheing system for my imageroll page. Because i take the images from vi.sualize.us servers and we don't want to make to much trafic and make stuff worse for them.</p><p>So what i did is simple, i made a class that extracts the rss data from theirs servers and get the images to display them. I do this every time someone visits the page.</p>]]></description> <content:encoded><![CDATA[<div
id="attachment_164" class="wp-caption alignleft" style="width: 287px"><a
href="http://blog.ajaxmasters.com/wp-content/uploads/2009/09/cache.png"><img
src="http://blog.ajaxmasters.com/wp-content/uploads/2009/09/cache.png" alt="Cache Pic" title="cache" width="277" height="277" class="size-full wp-image-164" /></a><p
class="wp-caption-text">Cache Pic</p></div><p>As I said in my last post, I wanted from the first time to make a cacheing system for my imageroll page. Because i take the images from vi.sualize.us servers and we don&#8217;t want to make to much trafic and make stuff worse for them.</p><p>So what i did is simple, i made a class that extracts the rss data from theirs servers and get the images to display them. I do this every time someone visits the page. If any image is new for the first time we display the image from vi.sualize.us and run a functions in javascript to check for new images. If any new images exist then we cache them in a folder on our server and the next time a user visits the page that image will be shown from our server. Pretty simple.</p><p>For now i&#8217;ll just show you the stuff that makes this thing run and if you want i can share the whole script so that you can make one for your blog or website.</p><p>I&#8217;ll also try to make a WordPress plugin so you can integrate it easily in your blog.</p><p>So here we go. We start with the function that checks for new images:</p><pre class="brush: php; title: ; notranslate">
functio checkCache($image_url){
            $path=pathinfo($image_url);
            $img_cached = 'cache/'.$path['filename'].'.'.$path['extension'];
            if(!file_exists($img_cached)) {
                createCacheImg($image_url);
            }
}
</pre><p>This function just checks if the image exists in the &#8220;<b>cache</b>&#8221; folder. If it&#8217;s not there then we run the &#8220;<b>createCacheImg</b>&#8221; function.</p><p>We now need a function to get the image so we check if the image is in the cache folder or not so we know what to display.</p><pre class="brush: php; title: ; notranslate">
    function getImage($or_img) {
        $path=pathinfo($or_img);
        $filename=$path['filename'];
        $img_cached = 'cache/'.$filename.'.'.$path['extension'];
        if(file_exists($img_cached)) {
            $url=$img_cached;
        }else {
            $url=$or_img;
        }

        return $url;
    }
</pre><p>Very simple function that just returns the right url of the image.</p><p>Now we cache the image.</p><pre class="brush: php; title: ; notranslate">
function createCacheImg($image){
        $srcsize = getimagesize($image);
        $w = $srcsize[0];
        $h = $srcsize[1];

        $path=pathinfo($image);
        $dest='cache/'.$path['filename'].'.'.$path['extension'];
        if($path['extension']=='jpg' || $path['extension']=='jpeg' || $path['extension']=='JPG') {
            $src_img = imagecreatefromjpeg($image);
        }else if($path['extension']=='gif') {
                $src_img = imagecreatefromgif($image);
            }else if($path['extension']=='png') {
                    $src_img = imagecreatefrompng($image);
                }
        $img_cpy=imagecreatetruecolor($w,$h);
        imagecopy($img_cpy, $src_img, 0, 0, 0, 0, $w, $h);
        if($path['extension']=='jpg' || $path['extension']=='jpeg' || $path['extension']=='JPG') {
            imagejpeg($img_cpy,$dest);
        }else if($path['extension']=='gif') {
                imagegif($img_cpy,$dest);
            }else if($path['extension']=='png') {
                    imagepng($img_cpy,$dest);
                }
        imagedestroy($src_img);
}
</pre><p>This function will save the image into the cache folder. Now we need a new file &#8220;<b>checkcache.php</b>&#8221; where we put this code:</p><pre class="brush: php; title: ; notranslate">
include('functions.php');
$image=$_GET['image'];
checkCache($image);
</pre><p> Right now we should have this kind of structure in our imageroll folder: A folder &#8220;<b>cache</b>&#8221; a file &#8220;<b>functions.php</b>&#8221; where we place all these functions we just did and a file &#8220;<b>index.php</b>&#8221; where we run the javascript function and display the images.</p><p>The &#8220;<b>index.php</b>&#8221; file requires this code:</p><pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;head&gt;

        &lt;title&gt;
            Image ROLL
        &lt;/title&gt;

        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
        &lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;  google.load(&quot;jquery&quot;, &quot;1.3.2&quot;); &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
&lt;input type=&quot;hidden&quot; id=&quot;image&quot; value=&quot;http://test.com/image.jpg&quot;&gt;
&lt;img src=&quot;&lt;?=getImage($image)?&gt;&quot; alt=&quot;test image&quot;/&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre><p>We have here a simple index.php file that imports the google api and jquery so we can run a simple ajax function. This is the javascript code that you should insert in this file or a separate one if you want:</p><pre class="brush: jscript; title: ; notranslate">

            $(document).ready(function() {
                checkCache();
            });

            function checkCache(){
                var page=$('#image');
                var url='checkcache.php';
                var pars='page='+page.val();
                $.get(url,pars);
            }
</pre><p>This will run this function after the page loads and it will check for new images. So this is just a simple script that will make you pages load faster expecialy if you load the images from outside of your server.</p><p>If you liked this i&#8217;ll go and make a more complex one and even share the imageroll script i did. That until i find the time and make a WordPress Plugin.</p> ]]></content:encoded> <wfw:commentRss>http://blog.ajaxmasters.com/use-ajax-to-create-a-cacheing-system/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching 1/13 queries in 0.059 seconds using disk: basic
Object Caching 387/414 objects using disk: basic

Served from: blog.ajaxmasters.com @ 2012-02-05 06:28:32 -->
