Jump to content

ploblem with resize


yosii

Recommended Posts

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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????

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.