title: how handling image's mime type "application/octet-stream"?
body: <p>I have a function to make thumbnail of a url image on fly!
  I always pass to this functions images with type jpg, but the problem appears when I pass an image with ".jpg" extension. but when i try to get its mime type, i found that's "<strong>application/octet-stream</strong>" .. in this <a href="http://php.net/manual/en/function.image-type-to-mime-type.php" rel="noreferrer">php page</a>, this mime type refers to one of</p>
  
  <p>IMAGETYPE_JPC,IMAGETYPE_JPX,IMAGETYPE_JB2</p>
  
  <p>what I need to modify my function to handle this mime type ??</p>
  
  <p><strong>notice  ^^^^^^</strong></p>
  
  <pre><code>function thumb($path,$width,$height) // $path =&gt; image url
  {
          $file_dimensions = getimagesize($path);
          $file_type = image_type_to_mime_type($file_dimensions[2]);
          list($Cwidth, $Cheight) = getimagesize($path);
          if ($file_type=='image/jpeg'||$file_type=='image/pjpeg'){
              // Load
          $thumb = imagecreatetruecolor($width, $height);
          $source = imagecreatefromjpeg($path);
          // Resize
          imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $Cwidth, $Cheight);
          header('Content-Type: image/jpeg');
          imagejpeg($thumb);
          }
          else if ($file_type=='application/octet-stream')
          {
             // ^^^^^ what I should write here
          }
          else
          {
              echo "Not supported type";
          } 
  } 
  </code></pre>