Jump to content

Image is not resizing?


Recommended Posts

Sorry bit rusty but been trying this for hours I upload an image no errors are showing i upload a jpg file and it saves to the server fine but its saving the original size not the new resized image size any ideas??



if (isset ($_FILES['file'])) {

		$tmp_name = $_FILES["file"]["tmp_name"];
                  $file_type = $_FILES["file"]["type"];
		$fileatt_name = $_FILES["file"]["name"];

if ($file_type=="image/pjpeg" OR $file_type=="image/jpeg" OR $file_type=="image/jpg")
$src = imagecreatefromjpeg($tmp_name);
} // END if ($file_type=="image/pjpeg" OR $file_type=="image/jpeg" OR $file_type=="image/jpg")

if ($file_type=="image/png" OR $file_type=="image/x-png")
$src = imagecreatefrompng($tmp_name);
} // END if ($file_type=="image/png" OR $file_type=="image/x-png")

if ($file_type=="image/gif")
$src = imagecreatefromgif($tmp_name);
} // END if ($file_type=="image/gif")

$width = $width;
$height = $height;
$newwidth = "200";
$newheight = "200";

$newwidth = "200";
$newheight = "200";

$newwidth = "200";
$newheight = ($newwidth*$ratio);

$newheight = "200";
$newwidth = ($newheight*$ratio);

$tmp = imagecreatetruecolor($newwidth, $newheight); 
$new=imagecopyresampled($tmp, $src,0,0,0,0,$newwidth,$newheight,$width,$height); 
$filename = "./yxy/". $fileattt_name;


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.

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.