Laravel 6 screenshot

Posted on: November 26, 2020 08:34 PM

Posted by: Renato

Categories: Laravel

Views: 120

Uso no Laravel 6


composer require microweber/screen
composer require jakoch/phantomjs-installer microweber/screen

php -S localhost:8001

Caso tenha algum problema

Ubuntu 20.04 sudo apt-get install -y php7.2-bz2

composer require jakoch/phantomjs-installer microweber/screen
php -d memory_limit=4G $(which composer) install 
php -d memory_limit=4G $(which composer) update

Uso no Laravel 6

use Screen\Capture;
public function iframeType($src) 
        $url = $src;
        $screenCapture = new Capture($url);

        //$fileLocation = Storage::disk('temp')->put('screenshot_iframe.png', Storage::disk('temp')->get('screenshot_iframe.png')); 
        $fileLocation =storage_path('/app/public/screenshot.png');

        $screenCapture->save($fileLocation); // Will automatically determine the extension type
        //echo $screenCapture->getImageLocation();
        return $screenCapture->getImageLocation();

- Repositorio do pacote completo:

About Author



Add a Comment
Comments 1 Comments
  • Renato de Oliveira Lucena
    Renato de Oliveira Lucena - 1 month ago
    This will output all the page including the content rendered beyond the setted dimensions (e.g.: all the scrollable content), if you want just the content inside those boudaries you need to clip the result // You also need to set the width and height. $screenCapture->setClipWidth(1200); $screenCapture->setClipHeight(800);