Ejemplo n.º 1
0
 public function capture(Screenshot $screenshot)
 {
     $request = $this->client->getMessageFactory()->createCaptureRequest($screenshot->url, 'GET');
     $request->setCaptureFile($screenshot->storagePath);
     $request->setViewportSize($screenshot->width, $screenshot->getViewportHeight());
     $request->setTimeout(1000);
     $request->setDelay(1);
     // Delay Rendering for 1 sec (Animations etc.)
     /*
      * If height is set by user, crop the image
      */
     if (isset($screenshot->height)) {
         $request->setCaptureDimensions($screenshot->width, $screenshot->height, 0, 0);
     }
     $response = $this->client->getMessageFactory()->createResponse();
     $this->client->send($request, $response);
 }