$product_image1 = $_FILES['product_image1']['name'];
$source = $_FILES['new_image']['tmp_name'];
$target = "../../media/product/".$product_image1;
// move_uploaded_file($source, $target);
$imagepath = $product_image1;
$save = "../../media/product/" . $imagepath; //This is the new file you saving
$file = "../../media/product/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($_FILES['product_image1']['tmp_name']) ;
$modwidth = 150;
$diff = $width / $modwidth;
$modheight = 155;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($_FILES['product_image1']['tmp_name']) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 75) ;
No comments:
Post a Comment