well, you can also resize the image after upload.
function createFixSizeImage( $pathToImages, $pathToFixSizeImages, $Width ) { // open the directory $dir = opendir( $pathToImages ); // loop through it, looking for any/all JPG files: while (false !== ($fname = readdir( $dir ))) { $image_info = getimagesize( "path/to/images/".$fname ); $image_width = $image_info[0]; $image_height = $image_info[1]; $image_type = $image_info[2]; switch ( $image_type ) { case IMAGETYPE_JPEG: // parse path for the extension $info = pathinfo($pathToImages . $fname); // continue only if this is a JPEG image if ( strtolower($info['extension']) == 'jpeg' ) { // load image and get image size $img = imagecreatefromjpeg( "{$pathToImages}{$fname}" ); $width = imagesx( $img ); $height = imagesy( $img ); // give the size,u want $new_width = 100; $new_height = 100; // create a new temporary image $tmp_img = imagecreatetruecolor( $new_width, $new_height ); // copy and resize old image into new image imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // save Fix Size Images into a file imagejpeg( $tmp_img, "{$pathToFixSizeImages}{$fname}" ); } break; case IMAGETYPE_PNG: // parse path for the extension $info = pathinfo($pathToImages . $fname); // continue only if this is a JPEG image if ( strtolower($info['extension']) == 'png' ) { // load image and get image size $img = imagecreatefrompng( "{$pathToImages}{$fname}" ); $width = imagesx( $img ); $height = imagesy( $img ); $new_width = 100; $new_height = 100; // create a new temporary image $tmp_img = imagecreatetruecolor( $new_width, $new_height ); // copy and resize old image into new image imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // save Fix Size Images into a file imagejpeg( $tmp_img, "{$pathToFixSizeImages}{$fname}" ); } break; case IMAGETYPE_BMP: echo "bmp"; break; default: break; } } } // close the directory closedir( $dir ); } createFixSizeImage("path","path/to/images/to/be/saved",100);