August 15, 2011

Fancy Uploader Browse File Button Issue With mootools-core-1.3.2-full-compat.js

Fancy Uploader Browse File Button Issue With mootools-core-1.3.2-full-compat.js Change line 5873: From: wMode: ‘window’, To: wMode: ‘transparent’,

August 14, 2011

$(“.class”) returns object

jQuery $(“.class”) returns object <html> <head> <script type=”text/javascript” src=”js/jquery.js”></script> <script type=”text/javascript”> $(document).ready(function(){ $(“label”).mousout(function(){ $(“.divClass”).hide(); }); }); </script> </head> <body> <h3 class=”divClass”>Hello world! text</h3> <p class=”divClass”>Hello world paragraph text.</p> <p>This is another paragraph.</p> <label>Try to mouseover and then mouseout on here</label> </body> </html> Observed: JQuery $(“.class”) returns object as we have var obj = document.getElementByClassName(‘domObjClasses’); But […]

CPanel Cron Jobs Syntax

/usr/local/bin/php -q /home/user_name/public_html/filename.extension

August 11, 2011

PHP Go Back Button Example

PHP Go Back Button Example Page 1:   <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ /> <title>Page1 Example Go Back</title> </head> <body> <form action=”page2.php” method=”post”> <input type=”submit” /> </form> </body> </html>   Page2: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; […]

August 10, 2011

How to add a postfix to a filename or image name?

function postfixToImg($postfix,$img_src) { $img = explode(‘.’,$img_src); $img[(count($img)-2)] = $img[(count($img)-2)].$postfix; $return = implode(‘.’,$img); return $return; }

get image proportions from smaller to larger or vice versa in php image maipulation

function positionFromSmallToLarge($positions=array(‘x’=>0,’y’=>0),$dms=array(‘w’=>0,’h’=>0),$dml=array(‘w’=>0,’h’=>0)) { #POSITIONS FOR LARGE IMAGE $largeX = 0;//UNKNOWN $largeY = 0;//UNKNOWN #DIMENSIONS LARGE ARE $largeWidth = $dml[‘w’]; $largeHeight = $dml[‘h’]; #DIMENSIONS SMALL ARE $smallWidth = $dms[‘w’]; $smallHeight = $dms[‘h’]; #POSITIONS OF AN OBJECT SPOTTED ON SMALL IMAGE ARE $smallX = $positions[‘x’]; $smallY = $positions[‘y’]; $percentFromLeft = ($smallX/$smallWidth); #CONSIDER IT IN PERCENT WITHOUT X […]

Resize image with PHP image libraries gd2 and imagick

function smart_resize_image($file, $width = 0, $height = 0, $proportional = false, $output = ‘file’, $delete_original = true, $use_linux_commands = false, $imagick=FALSE ) { if ( $height

getImgSrc a handy function in PHP image manipulation for php developers

function getImgSrc($fileName) { $mime_type = getimagesize($fileName); //print_r($mime_type); switch($mime_type[‘mime’]) { case ‘image/png’: $src = imagecreatefrompng($fileName); break; case ‘image/gif’: $src = imagecreatefromgif($fileName); break; case ‘image/jpeg’: $src = imagecreatefromjpeg($fileName); break; case ‘image/wbmp’: $src = imagecreatefromwbmp($fileName); break; } return $src; }