General function

Bhavesh M Khanpara

<?php

//Detect if the Browser is Internet Explorer
function detectIE(){
if (isset($_SERVER['HTTP_USER_AGENT']) &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
return true;
else
return false;
}


// Detect if the Browser is FireFox
function detectFF(){
if (isset($_SERVER['HTTP_USER_AGENT']) &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false))
return true;
else
return false;
}
 // Create unique filename function uniqueFilename($length=12, $path, $ext) { $characters = "0123456789abcdefghijklmnopqrstuvwxyz"; $string = ""; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters) -1)]; } while (file_exists($path.$string.$ext)){ $string = uniqueFilename($length++, $path, $ext); } $string = $string.'.'.$ext; return $string; } // Resize an image for GD function resizeImage($pathToImage, $newPath, $thumbWidth, $swap=false, $square=false){ $info = pathinfo( $pathToImage ); $extension = strtolower( $info['extension'] ); $newImagePath = $newPath.$info['filename'].'.'.$extension; if (!$swap){ list($width, $height, $imgtype) = getimagesize($pathToImage); $ratio = $width / $height; /* Decide how we should resize image - fixed width or fixed height */ if ($height > $width) { $type = 'fixedheight'; } else…

View original post 1,244 more words

Advertisements

What is Zend Framework or why we should use it?

Salahuddin's Blog {quote: 'Ride on the horse'}

Zend Framework is an open source framework for developing web applications with PHP 5.

Zend Framework is implemented using 100% object-oriented code.

The component structure of Zend Framework is somewhat unique; each component is designed with few dependencies on other components. This loosely coupled architecture allows developers to use components individually.

Zend Framework offers a robust, high performance MVC implementation, a database abstraction that is simple to use, and a forms component that implements HTML form rendering, validation, and filtering so that developers can consolidate all of these operations using one easy-to-use, object oriented interface.

View original post