Example #1
0
 /**
  * Create Screenshot and Redirect to Try-Route.
  *
  * @return Illuminate\Http\RedirectResponse
  */
 public function createTestScreenshot()
 {
     $proof = trim(strtolower(Input::get('proof')));
     if ($proof != 'laravel') {
         return redirect()->route('home.landingpage');
     }
     $url = Input::get('url');
     // Validate Input
     $validator = new ScreenshotValidator();
     $validator->validate(Input::all());
     // Check if Host is available
     $checkHost = new CheckHostService();
     $checkHost->ping($url);
     // Actually Capture the Screenshot
     $screenshot = new Screenshot();
     $filename = $screenshot->generateFilename();
     $screenshot->setPath('images/try/');
     $screenshot->setStoragePath($filename);
     $screenshot->setHeight(Input::get('height'));
     $screenshot->setWidth(Input::get('width', 1024));
     $screenshot->capture($url);
     return redirect()->route('try')->with('asset', $screenshot->assetPath);
 }
Example #2
0
 /**
  * @expectedException Exception
  */
 public function testPingForWrongUrl()
 {
     $service = new CheckHostService();
     $service->ping('http://www.googleisnotavailable.com');
 }