예제 #1
0
 public function show()
 {
     $id = Session::remove("blinkId");
     if ($id != null) {
         $blink = Blink::find($id);
         $blink->time_viewed;
         if ($blink != null && $blink->view_time > $blink->time_viewed) {
             $path = $blink->file_location;
             $file = new Symfony\Component\HttpFoundation\File\File($path);
             $response = Response::make(File::get($path), 200);
             // Modify our output's header.
             // Set the content type to the mime of the file.
             // In the case of a .jpeg this would be image/jpeg
             $response->header('Content-type', $file->getMimeType());
             // We return our image here.
             return $response;
         }
     }
 }
예제 #2
0
 public function view($token)
 {
     $blink = Blink::where("url_token", "=", $token)->whereNull("expired_at")->first();
     if ($blink && $blink->view_time > $blink->time_viewed) {
         echo $blink->id;
         Session::put("blinkId", $blink->id);
         return View::make("blinks.view");
     } else {
         Session::remove("blinkId");
         echo "failed";
     }
 }