Jump to content

Recommended Posts

I am trying to add imagecopyresampled to my photo upload page so it scaled all images that are too big to 800 by 600

 

 

THE CODE FOLLOWS

 

 

    if ($size[0] > $max_image_width || $size[1] > $max_image_height){$nrs=1;} else {$nrs=0;}

if(man_MIME2Ext($_FILES["filename_1"]['type']) != "")

{

$file_source = $member_code."_$number.".man_MIME2Ext($_FILES["filename_1"]['type']);

upload_file($_FILES["filename_1"]['tmp_name'], "photos/$file_source", man_MIME2Ext($_FILES["filename_1"]['type']));

if ($nrs=1){

 

// ## Will this next line properly asign the imagefile? ###

 

  $image = "photos/$file_source";

 

 

  header("Content-type: image/jpeg");

     

    if(substr($image, -3)=="jpg" || substr($image, -3)=="JPG"){$im = imagecreatefromjpeg($image);}

    elseif(substr($image, -3)=="gif" || substr($image, -3)=="GIF"){$im = imagecreatefromgif($image);}

    elseif(substr($image, -3)=="png" || substr($image, -3)=="PNG"){$im = imagecreatefrompng($image);}

   

 

 

        $x = 800;

        $y = 600;

        $yyy=0;

        $xxx=0;

        $imw = imagecreatetruecolor($x,$y);

 

   

    imagecopyresampled($imw, $im, 0,0,0,0,$x,$y,imagesx($im), imagesy($im));

}

// Do I need an output file in here somewhere?

 

please some suggestions on how to fix this up

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.