PHP

November 25, 2011 PHP no responses # , ,

Fast, Effective PHP Compression With .htaccess

PHP compression is an excellent method of conserving bandwidth and reducing client download times. We have already discussed an excellent method for CSS compression, and in this article we share a super-easy technique for compressing all PHP content without editing a single file.

Using two PHP files and two corresponding lines of

.htaccess

, it is possible to compress your PHP files via gzip-encoding. Browsers and other user-agents capable of interpreting gz-encoded data will employ the compressed content, while other user-agents will utilize the content uncompressed.

Before we begin, it is important to determine if your server employs output buffering. If so, it may not be necessary to compress content via this method. Also, this PHP compression technique requires PHP version 4.0.5 or better.
Continue reading

November 24, 2011 PHP no responses # ,

Calculate folder and subfolders size with PHP

Those days i was wondering whether i could read the size of a directory using PHP. So i thought of making something which could help me read the size of the directory, number of directories and the number of files in the given directory.

So here are my 2 little functions doing that bit:

The function “filesize_recursive” will ignore link/shortcuts to files/directory.
The function “display_size” will suffix the size with bytes, KB, MB or GB accordingly.
Continue reading

October 23, 2011 PHP no responses # , ,

Reading images exif data with PHP

In most photos from digital cameras besides the actual image, there’s a little ”information block” call EXIF data. If you have the correct PHP extension installed on your server – the one called ”exif” – it’s pretty easy to read the EXIF data and display them, as you like.
Continue reading

October 23, 2011 PHP no responses # ,

A PHP Library For Image Manipulation: Imagine

Imagine is an object-oriented PHP library for working with images and manipulating them. The library can handle frequently-used operations like resize, crop or applying filters. A color class helps generating the RGB values of any given color and methods exist for drawing shapes like arc, ellipse, line, pieSlice and more.

Imagine is a OOP library for image manipulation built in PHP 5.3 using the latest best practices and thoughtful design that should allow for decoupled and unit-testable code.
Continue reading

1 2 3
Stay In Touch