Skip to main content

Posts

Showing posts from February, 2013

Send HTML Formatted Mail using PHP

HTML markup and styling can make an email more attractive. We can send simple text mail by using PHP's mail function. But what about HTML formatted mail! Can we send HTML formatted mail same way? The answer is YES! But we need to add some header information (including content type) for this. Here an simple example for sending HTML mail using PHP.

Bitly URL Shorten using Bitly API and PHP

Bitly is one of the most powerful and popular URL shorten and bookmark service in the universe. Bitly offers simple and powerful API to generate short URL from long one. To use this API you have to signup for an API key. Bitly offers it free for it's all users. If you want, you can get it from Bitly's home page. Here's an example to create a short URL using PHP.

Multiple File Upload with PHP

Sometimes we need to allow our users to upload multiple file upload. On my previous post I was shown the basic of simple file upload with PHP. Today I am going to show you how to allow users to upload multiple files. It is almost similar like simple file upload but we need to do some modification with html markup and php code. multiple attribute is needed to add on the html markup. Major web browsers like Firefox, Chrome, Safari and IE 9+ support this attribute. Now I am going to show you how to upload multiple file with PHP and basic HTML form.

Backup MySQL Database With PHP

Database is the backbone of every dynamic websites. That's why webmaster needs to often backup there website's database. There are many ways to backup MySQL database like backup form phpmyadmin, using shell commend and also many other ways. Today I am going to show you my way to backup MySQL database. I have coded a PHP class to take MySQL database backup. This class can backup all or specified tables on a database.

CSS Compressing and Caching with PHP

Web developers always worried about there website's loading time. Because loading time is very important for a website's popularity. CSS compression and cache can speed up your website. I have created a PHP script for making CSS compression easy.
This script will allow you these functionalists:
Reduce CSS file size by removing comments and white space charactersKeep server side cache for rapid delivery.Enable GZip for compressed encodeEnable user side cache smartly.

Add Watermark to a Image with PHP GD

Sometimes we need to add watermark to our image contents. There are several ways to add watermark on image. Like editing image with Photoshop or other application and add watermark. This process is ok but not enough for a large dynamic website. Today I am going to show you how you can add watermark to images automatically with PHP GD functions.

Create Image From Text Using PHP

Creating image from text is one of the basic skill for PHP developers. It is very easy task. To do this we need to use a True Type Font (TTF) and PHP GD library installed in system. Here I am going to show you a simple imagettftext example.


Create ZIP File with PHP using ZipArchive

Creating zip file using PHP is very easy. To do this you need to write couple of lines code. In this post I am going to show you how to create simple zip file using PHP. For do this I am using ZipArchive class. If your system dose not have support for this class you can download and install it from here.

Upload File with FTP using PHP

FTP is one of the most useful tool or protocol for all web developers or designers. We can move files from one server to another with FTP tools very easily. PHP provides build in support for FTP protocol. That’s why we can work with FTP very easily using some FTP functions. In this post I’m going to show how to upload or put file to a server using PHP functions.

Increase PHP Max Execution Time Limit with ini_set

PHP's default execution time limit is 30 seconds. It is tendered time but it not enough for all times especially when we working through long files or long precessing events. We needs to increase the PHP's max execution time limit to do this script run. There are two ways to do this. Onc is to edit the php.ini file and change the max_execution_time value(integers in seconds). But it is not possible for the all time because shared host-tings do not allows users to edit directly php.ini file. There is another way to do this via ini_set function. Let's see how...

Format File Size into Byte, KB, MB, GB and TB with PHP

We can calculate a file's size using PHP's build in filesize function. This function returns file size in byte(integer). This value is good enough to working with file but this value is quite heard for human eyes if this value is big to bigger. We can give a nice formatted look to this value by using some code very. Here is a simple example of function byte_convert that can convert file size into  byte, kb, mb, gb and tb.

Simple File Upload with PHP

In this post I am going to show you how to upload file to server using simple PHP and HTML code. Uploading files with php is one of the most fundamental programming skill. This script will allow you to upload single image file and store it to the specified directory to the server for later usage.

Time Ago Using PHP

In my first post I want to present you all a simple PHP time age function. This function can calculate Linux timestamps and returns how much time ago it occurred. As we saw other social networking sites (like Facebook, Twitter, YouTube). If we post something on these sites we can see how much time ago it was posted.