title: Square thumbnail advance
body: <p>I have a php thumbnail function. How it works you can check below:</p>
  
  <pre><code>public static function makeThumb($source, $destination, $thumb_width){
  
          $size   = getimagesize($source);
          $width  = $size[0];
          $height = $size[1];
          $x      = 0;
          $y      = 0;
  
          $status  = false;
  
          if ($width &gt; $height) {
              $x      = ceil(($width - $height) / 2);
              $width  = $height;
          } else if ($height &gt; $width) {
              $y      = ceil(($height - $width) / 2);
              $height = $width;
          }
  
          $new_image = imagecreatetruecolor($thumb_width,$thumb_width) or die ('Cannot Initialize new GD image stream');
          $extension = self::get_file_extension($source);
          if ($extension == 'jpg' || $extension == 'jpeg')
              $image = imagecreatefromjpeg($source);
          if ($extension == 'gif')
              $image = imagecreatefromgif($source);
          if ($extension == 'png')
              $image = imagecreatefrompng($source);
  
          imagecopyresampled($new_image,$image,0,0,$x,$y,$thumb_width,$thumb_width,$width,$height);
  
  
          if ($extension == 'jpg' || $extension == 'jpeg')
              $status = @imagejpeg($new_image, $destination);
          if ($extension == 'gif')
              $status = @imagegif($new_image, $destination);  
          if ($extension == 'png')
              $status = @imagepng($new_image, $destination);      
  
          imagedestroy($image);
  
          return $status;
      }
  </code></pre>
  
  <p>Please check images below (how it works):</p>
  
  <p><img src="https://i.stack.imgur.com/05TVc.png" alt="Original image">
  <img src="https://i.stack.imgur.com/7Vfme.png" alt="Thumbnail image result"></p>
  
  <p>Question: How can I get this image as a result (This thumb is from photoshop)?</p>
  
  <p><img src="https://i.stack.imgur.com/Qf4XC.png" alt="I need this thumb"></p>