Base64 encoding format for images

Today we are taking about the new base64 encoding format for displaying the image or a collection of images. If you have the images with large size then it will take more time to load on the page, base64 encoding provide you the string which will contain all the image data, and load in minimum time on the page. Actually base64_encode() represent the binary data into into an ASCII string format. As you see google also uses the string format for the images to prevent from the server load. You will use this base64 encoded string in ‘img’ tag something like this:

Creating zip file archives in php

In this post we are talking about to creating zip file in PHP. It’s very simple to create zip file, similar to creating in desktop. There is one more logic behind to creating zip file, if you want give some stuff for download to your users, then you have to upload completely zip file in your server then provide the download link over it.

But with the use of this function you just have to give the files that you want to store in zip and the name of the zip file that you want to create, yes you will create a single zip file with the collection of files. As you see in the below codes i have created a simple form and with the use of check-box i have given the choice for the files that you want to add in the zip file, and then all the rest work depending on the PHP.

Get focused element in jquery

Mainly jQuery .focus() event is used to get focused element, but what if we have a chain of elements in a single .focus() event? In this post i simple describe that how do we get focused element with jquery in a chain of elements with the use of .focus() event. As you see below highlighted codes i show you both the jquery section and the html section, First i want to describe the html section, in the HTML section in also mentioned the ID of the the input element, all the ID’s are different according to the input element.

Short a string without cutting words

I develop this function to short the string without cutting the words. As we now that PHP’s substr() function only provide the part of the string, substr() function provide the string between the two parameters, start from and end to.

So I need a function that provide the string arround the given starting from and end to range. Below given function provide the arround complete word from the string. This function check the nearest space into the string and provide the nearest word without cutting. If you guys have a better alternative then please feel free to share the codes in the comment section.

Countdown timer in javascript

Here i introduce with the simple countdown timer script written in JavaScript. My main purpose behind this countdown timer script is just logout the user if he/she is idle. In this example i set the idle time 15 minutes, means the user will automatically logout if he/she do not active on the page. To achieve this i used window.setInterval() javascript function, which is call my own defined function after every 1 second. As you see in the below example i have created a function getIdleTime(), this function calculate every minute and second and display to the user, as you see i called an id with document.getElementById(), just call the id where you want to show your countdown timer.

Speed Up your website with htaccess caching

If we are talking about SEO, then google has been announced that the speed of your web page also matters to improving your page rank and website performance. In this post, we are talking about that how to improve the website loading performance so that the speed of loading the webpage also increase, and if you want to check the increased speed of your webpage the there is a page speed add-on available for Firefox, which is automatically integrated into firebug.