سلام دوستان
من یه مشکلی دارم، من یه سری کالا رو در فروشگاه اینترنتی از لینک ایکس ام ال درافت می کنم روی دیتابیس ذخیره می کنم و عکس ها رو هم کپی می کنم می شونم روی سرور الان مشکلی که هست اینه که حجم عکس هایی که آپلود شده خیلی بالاست می خوام ببینم میشه عکس هایی که آپلود شده و حجشون رو کم کنم و این که چجوری میشه عکس ها رو قبل از آپلود حجمشون رو کم کنم من کد رو می ذارم اینجا که کارهایی هست که انجام می دم

function UploadImage($xmlimage , $product_id , $imageroot){
if($xmlimage !=""){
$xmlimage = trim($xmlimage);
$image = $imageroot."/media/xmlkoreay/".end(explode('/' , $xmlimage));
$imagesave = "/media/xmlkoreay/".end(explode('/' , $xmlimage));
mysql_query("update mod_shop_product set indeximage22 = '".$imagesave."' , indeximage3 = '".$imagesave."' , indeximage = '".$imagesave."' where id = '".$product_id."'") or die(mysql_error());
if(copy($xmlimage,$image)){
mysql_query("INSERT INTO mod_shop_product_image (file_url , product_id) VALUES ('" . $imagesave . "' , '" . $product_id . "') ") or die(mysql_error());
}
/*if(download($xmlimage,$image)) {
mysql_query("INSERT INTO mod_shop_product_image (file_url , product_id) VALUES ('" . $imagesave . "' , '" . $product_id . "') ") or die(mysql_error());
}*/else {
$error = json_encode(error_get_last());
mysql_query("INSERT INTO log_image_copy (type,copyimage , file_url , product_id,error_report) VALUES ('koreay','".$xmlimage."','" . $imagesave . "' , '" . $product_id . "','$error') ") or die(mysql_error());
}
}
}


1- چجوری میشه حجم اونایی که تو سرور آپلود شدن کم بشه
2- اینایی که از لینک میگیرم حجمشون رو کم کنم کپی کنم رو سرور خودمون


ممنون میشم اگر اطلاعاتی دارید راهنمایی کنید چون واقعا یک فاجعه ایی شده و سایت اصلا باز نمیشه و سرور هنگ می کنه ما تمام ساعت های روز این پیام رو میبینیم
Request Timeout

This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase 'Connection Timeout'

و فک می کنم به خاطر حجم عکس ها باشه