title: how to resize multiple images php
body: <p>I am trying to resize multiple images through a fileupload.
  the current code takes several images but only resizes one.Im new in php</p>
  
  <p>I have researched a lot in google in several languages ​​but I have not found anything that is just php</p>
  
  <p>php7, apache 2 </p>
  
  <pre><code>&lt;form class="form-horizontal" action="resise2.php" enctype="multipart/form-data" method="POST"&gt;
  &lt;input name="archivo" type="file" accept="image/png, image/jpg, 
   image/jpeg " multiple   /&gt; 
  &lt;input type="submit" name="submit"value=enviar&gt;
  &lt;/form&gt;
  
  &lt;?php
   if(isset($_POST["submit"])) {
   if(is_array($_FILES)) {
   $uploadedFile = $_FILES['archivo']['tmp_name']; 
   $nombre=$_FILES["archivo"]['name'];
   $sourceProperties = getimagesize($uploadedFile);
   $newFileName = time();
   $dirPath = "/fotospagina/";
   $ext = pathinfo($_FILES['archivo']['name'], PATHINFO_EXTENSION);
   $imageType = $sourceProperties[2];
  
      switch ($imageType) {
  
  
          case IMAGETYPE_PNG:
              $imageSrc = imagecreatefrompng($uploadedFile); 
              $tmp = 
  
  imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
              imagepng($tmp,$dirPath. $newFileName. "_thump.". $ext);
              break;           
  
          case IMAGETYPE_JPEG:
              $imageSrc = imagecreatefromjpeg($uploadedFile); 
              $tmp = 
  imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
              imagejpeg($tmp,$dirPath. $newFileName. "_thump.". $ext);
  
              break;
  
          case IMAGETYPE_GIF:
              $imageSrc = imagecreatefromgif($uploadedFile); 
              $tmp = 
  imageResize($imageSrc,$sourceProperties[0],$sourceProperties[1]);
              imagegif($tmp,$dirPath. $newFileName. "_thump.". $ext);
              break;
  
          default:
              echo "Invalid Image type.";
              exit;
              break;
      }
  
  
      move_uploaded_file($newFileName, $dirPath. $newFileName. ".". 
   $ext);
      echo "Image Resize Successfully.";
  
  
  ?&gt;
  </code></pre>