title: creating image thumb is not working
body: <p>Hello guys i have a file uploading page for my site that uploads one or more than one images. the </p>
  
  <p>problem is the creating thumb for my images whenever i am uploading the files so it should creating </p>
  
  <p>the thumbs for amount of images which is uploaded its showing confirmation massag but not creating </p>
  
  <p>thumbs for images.</p>
  
  <p>ACTUALLY i have download a <strong>package from PHP academy</strong> </p>
  
  <p>that contains this file (create.thumb.php) just i have called the function and its uploading text </p>
  
  <p>with images successfully but not creating the Thumbs of images inside Thumbs folder here is the code :</p>
  
  <pre><code>**create.thumb.php**
  
  &lt;?php
  function create_thumb($directory, $image, $destination) {
      $image_file = $image;
      $image = $directory.$image;
      if(file_exists($image)){
          $source_size = getimagesize($image);
          if($source_size !== false){
              $thumb_width = (int)$width;
              $thumb_height = (int)$height;
              switch($source_size["mime"]){
                  case "image/jpeg" : $source = imagecreatefromjpeg($image); break;
                  case "image/png" : $source = imagecreatefrompng($image); break;
                  case "image/gif" : $source = imagecreatefromgif($image); break;
              } $source_aspect = round(($source_size[0] / $source_size[1]), 1);
              $thumb_aspect = round(($thumb_width / $thumb_height), 1);
              if($source_aspect &lt; $thumb_aspect){
                  $new_size = array($thumb_width, ($thumb_width / $source_size[0]) * $source_size[1]);
                  $source_pos = array(0, ($new_size[1] - $thumb_height) / 2);
              } elseif($source_aspect &gt; $thumb_aspect){
                  $new_size = array(($thumb_width / $source_size[1]) * $source_size[0], $thumb_height);
                  $source_pos = array(($new_size[0] - $thumb_width) / 2, 0);
              } else {
                  $new_size = array($thumb_width, $thumb_height);
                  $source_pos = array(0, 0);
              } if($new_size[0] &lt; 1){
                  $new_size[0] = 1;
              } if($new_size[1] &lt; 1){
                  $new_size[1] = 1;
              } $thumb = imagecreatetruecolor($thumb_width, $thumb_height);
              imagecopyresampled($thumb, $source, 0, 0, $source_pos[0], $source_pos[1], $new_size[0], $new_size[1], $source_size[0], $source_size[1]);
              switch($source_size["mime"]){
                  case "image/jpeg" : imagejpeg($thumb, $destination.$image_file); break;
                  case "image/png" : imagepng($thumb, $destination.$image_file); break;
                  case "image/gif" : imagegif($thumb, $destination.$image_file); break;
              }
          }
      }
  }
  ?&gt;
  -------------------------------------------------------------------------------------------------
  
  **index.php**
  
  &lt;?php
  require_once('db.php');
  require_once('create.thumb.php');
  @$PropertyName=$_POST['pname'];
  @$PropertyStatus=$_POST['pstatus'];
  @$PropertyID=$_POST['propertyid'];
  if(isset($_FILES['file_upload']) &amp;&amp; !empty($_FILES['file_upload']))
  {
  
         $propertyquery="INSERT INTO properties(PropertyID, PropertyName, PropertyStatus) 
                                VALUES('$PropertyID', '$PropertyName', '$PropertyStatus')";
            $propertyqueryrun=$connection-&gt;query($propertyquery);
            $id = $connection-&gt;insert_id;
                if(!$propertyqueryrun)
                {
                   echo '&lt;br&gt;&lt;br&gt; Property Insertion Failed';
  
                }
                else
                {
                     echo '&lt;br&gt;&lt;br&gt; The Property Information Insertion was Successfully &lt;br&gt;&lt;br&gt;';
  
                }
  
      mkdir("upload/$PropertyID");
      $files=$_FILES['file_upload'];
  
      for($x = 0; $x &lt; count($files['name']); $x++)
      {
        $name=$files['name'][$x];
        $tmp_name=$files['tmp_name'][$x];
           if(move_uploaded_file($tmp_name, "upload/$PropertyID/".$name))
           {
               $insert_id=$id;
  
               **create_thumb('upload/$PropertyID/',$name,'thumbs/$PropertyID/');**
  
               $imagequery="INSERT INTO propertyimages(PropertyImageID, ImageName, ImagePath) VALUES('$insert_id', '$name', 'upload/$PropertyID/$name')";
               $imagequeryrun=$connection-&gt;query($imagequery);
               echo 'Image '. $name .' Uploaded Successfully &lt;br&gt;';
           }
           else
           {
               echo 'YOU HAVE TO SELECT ONE PIC AT LEAST';
           }
  
      }
  
  }
  ?&gt;
  </code></pre>