yosii Posted August 27, 2008 Share Posted August 27, 2008 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 Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 27, 2008 Share Posted August 27, 2008 WBMP is a Wireless BMP file with the ".wbmp" extension. PHP doesn't currently support native BMP files. I guess ImageMagick supports BMP but you'll have to rewrite the entire script (or probably find another one ). Don't know what are you using that code for, but usually jpgs or pngs are preferred image formats, so just support them. Quote Link to comment Share on other sites More sharing options...
yosii Posted August 27, 2008 Author Share Posted August 27, 2008 WBMP is a Wireless BMP file with the ".wbmp" extension. PHP doesn't currently support native BMP files. I guess ImageMagick supports BMP but you'll have to rewrite the entire script (or probably find another one ). Don't know what are you using that code for, but usually jpgs or pngs are preferred image formats, so just support them. according that script i support jpg and png,rghit?? so...you don't have any idea for me how to do resize to bmp???? Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 27, 2008 Share Posted August 27, 2008 If you read my post carefully (which you didn't), would have seen that i suggested ImageMagick. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.