我一直在尝试使用以下代码在上传时压缩图像,但无法确定在其中实现压缩代码的位置。求助。
$timestamp = date('Y-m-d:h:i:s');
if($_FILES['file1']['name']!="")
{
$sql_banner_id = "SELECT MAX(id) from autosale";
$result_banner_id = mysql_query($sql_banner_id);
$rs_banner_id = mysql_fetch_array($result_banner_id);
if($rs_banner_id[0]==0)
{
$banner_id = 1;
}
else
{
$banner_id = $rs_banner_id[0]+1;
}
$control_name = "file1";
$target = "autosale_image";
$new_name = "sale".$banner_id;
$path = upload_all_photo($control_name, $target, $new_name, 80);
$control_name = "file2";
$target = "autosale_image";
$new_name = "sale1".$banner_id;
$path1 = upload_all_photo($control_name, $target, $new_name, 80);
}
$sql_add_directory = "INSERT INTO autosale
(
name , email , m_address, contact , city , country, c_companyname, model, variant, km, description, price, image_path, image_path1, timestamp
)
VALUES
(
'$name', '$emailid', '$address', '$mobile', '$city', '$country', '$carmake', '$car_model','$variant', '$km', '$description', '$price', '$path', '$path1', '$timestamp'
)";
//echo $sql_add_directory;
$result_add_directory = mysql_query($sql_add_directory) or die("error".mysql_error());
//header("location:thanks_subscription.php"); // redirect for normal user
echo "<script language='javascript'>window.location='thanks_autosale.php';</script>";