0

I have image upload code like this now i want to reduce the size of the image before going to upload

 $make = $_POST['make'];
 $file_name = $_FILES['image']['name']; 
 $file_size = $_FILES['image']['size'];
 $file_tmp = $_FILES['image']['tmp_name'];
 $file_type = $_FILES['image']['type'];    
 $file_ext= explode('.',$_FILES['image']['name']);
 $make_filename = str_replace(" ","-",$make).".png";

  if($file_ext[1]!="png"){
     $error =  "extension not allowed, please choose Only PNG file.";
  }
   $array_folder = array('136','180','36','42','68','90');    
  if($error==""){
     if( move_uploaded_file($file_tmp,"../images/logos/png/".$make_filename)){        
      $succ = "Successfully Uploaded Image"; } else { echo "error";}

$array_folder array contains the folder names 136,180..etc if i am going to upload image then according to that folder name the image size has to be

thanks in advance

  • You won't be able to resize the image **before** uploading it with PHP. There might be a way to do it with javascript (in fact this is something that piqued my interest and I'll look into it). You can resize it multiple times for each of those folders using PHP once the file is uploaded to the server. – Geoff Atkins Oct 14 '15 at 10:52
  • @GeoffAtkins You can resize it multiple times for each of those folders using PHP once the file is uploaded to the server...can you please suggest for this – vamshi goli Oct 14 '15 at 11:03
  • You can't resize an image on the user's own computer before he/she uploads the image. – Professor Abronsius Oct 14 '15 at 11:11
  • You can use the solution given here: http://stackoverflow.com/questions/10029838/image-resize-with-php –  Oct 14 '15 at 11:25

0 Answers0