PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY // (Disney web site)
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY // get image name and build full pathname if (!empty($_POST[’pix’])) { $original = SOURCE_DIR.$_POST[’pix’]; } else { $original = NULL; } // abandon processing if no image selected if (!$original) { $result = ‘No image selected’; } // otherwise resize the image else { // begin by getting the details of the original list($width, $height, $type) = getimagesize($original); // calculate the scaling ratio if ($width <= MAX_WIDTH && $height <= MAX_HEIGHT) { $ratio = 1; } elseif ($width > $height) { $ratio = MAX_WIDTH/$width; } else { $ratio = MAX_HEIGHT/$height; } // strip the extension off the image filename $imagetypes = array(’/.gif$/’, ‘/.jpg$/’, ‘/.jpeg$/’, ‘/.png$/’); $name = preg_replace($imagetypes, ‘’, basename($original)); // create an image resource for the original switch($type) { case 1: $source = @ imagecreatefromgif($original); if (!$source) { $result = ‘Cannot process GIF files. Please use JPEG or PNG.’; } break; case 2: $source = imagecreatefromjpeg($original); break; case 3: $source = imagecreatefrompng($original); break; default: $source = NULL; $result = ‘Cannot identify file type.’; } // make sure the image resource is OK if (!$source) {
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.