title: Laravel Image thumb
body: <p>I making a web app where uploaded photos are stored in /app/storage.
  To show the file I am using a route ex: <code>showphoto/{id}</code> (Paths are stored in DB)</p>
  
  <pre><code>public function showphoto($id){
       $photo = Photo::findOrFail($id);
       return $this-&gt;getFile($photo);
  }
  private function getFile($f){
          if($f-&gt;path){
              $file = storage_path($f-&gt;path.'/'.$f-&gt;origin_name);
              if (File::exists($file)) {
                  $contents = File::get($file);
                  switch($f-&gt;ext) {
                      case "gif": $ctype="image/gif"; break;
                      case "png": $ctype="image/png"; break;
                      case "jpeg":
                      case "jpg": $ctype="image/jpeg"; break;
                      case "pdf": $ctype="application/pdf"; break;
                      default:
                  }
                  $response = Response::make($contents, 200);
                  $response-&gt;header('Content-Type', $ctype);
                  return $response;
              } 
          }
      }
  </code></pre>
  
  <p>To show image I am using</p>
  
  <pre><code>{{ HTML::image(route('showphoto', $photo-&gt;id), $photo-&gt;getName(), array('class'=&gt;'img-thumbnail', 'width' =&gt; '100', 'height'=&gt;'100')) }}
  </code></pre>
  
  <p>Question: Some file are more then 2 MB and when I have a list of them they are loading very slowly, So on the list I want to show just a Thumb of the photo.
  It is possible to create a temporary thumb that will not be stored anywhere?
  Or it is not a good idea to create a temporary thumb each time I load a page.
  Thank you in advance.</p>