look'i have a code that to a resize to picture
function makeimage($filename, $newfilename, $path, $newwidth, $newheight) {
//SEARCHES IMAGE NAME STRING TO SELECT EXTENSION (EVERYTHING AFTER . )
$image_type = strstr($filename, '.');
//SWITCHES THE IMAGE CREATE FUNCTION BASED ON FILE EXTENSION
switch($image_type) {
case '.jpg':
$source = imagecreatefromjpeg($filename);
break;
case '.png':
$source = imagecreatefrompng($filename);
break;
case '.gif':
$source = imagecreatefromgif($filename);
break;
default:
return;
}
//CREATES THE NAME OF THE SAVED FILE
$file = $newfilename . $filename;
//CREATES THE PATH TO THE SAVED FILE
$fullpath = $path . $file;
//FINDS SIZE OF THE OLD FILE
list($width, $height) = getimagesize($filename);
//CREATES IMAGE WITH NEW SIZES
$thumb = imagecreatetruecolor($newwidth, $newheight);
//RESIZES OLD IMAGE TO NEW SIZES
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
unlink($filename);
//SAVES IMAGE AND SETS QUALITY || NUMERICAL VALUE = QUALITY ON SCALE OF 1-100
imagejpeg($thumb, $fullpath, 60);
//CREATING FILENAME TO WRITE TO DATABSE
$filepath = $fullpath;
}
it's work but if i try to resize "bmp" image that function return eror
i treid to add
case '.gif':
$source = imagecreatefromwbmp($filename);
break;
but that do 2 error
imagecreatefromwbmp() [function.imagecreatefromwbmp]: 'pic/3.bmp' is not a valid WBMP file in
imagecopyresized(): supplied argument is not a valid Image resource
help me please to resize bmp image
thank