Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTimeout dosen`t work well ! #5

Open
ghost opened this issue Dec 26, 2017 · 6 comments
Open

setTimeout dosen`t work well ! #5

ghost opened this issue Dec 26, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 26, 2017

Hello
at first thank you for this package , i worked with it very well but setTimeout !
i set timeout 180 or 300 but generate the screenshot done soon and in any timeout i got screenshot under the 5 second and website images were blank or not completly loaded,

may you help me?

thanks.

@hotrush
Copy link
Owner

hotrush commented Dec 27, 2017

Hi, @webcoweb. Thanks for your response.
setTimeout method is mostly for page contents loading, not for images. Added a new features for images waiting - waitForImages() and setImagesLoadingTimeout(30). Check please and close if ok.

@ghost
Copy link
Author

ghost commented Dec 27, 2017

Hello,
Dear Hotrush i checked it and unfortunately the result was same as before,
I use below code:

`
$jpg = $webshot

		->setUrl('https://github.com/')
		->setWidth(1200)
		->setHeight(800)
		->setTimeout(45) // set timeout in seconds, 30 seconds default
		->setFullPage(false) // set to true to get full page screenshot (width/height will be used for viewport only)
		->waitForImages() // wait when all images will load
		->setImagesLoadingTimeout(180) // images loading timeout, will failt if not loaded
		->saveToPng('screenshot', 'myimages/');

`

and i got image not compeletly , you can see it in this url:
https://pasteboard.co/H0acKej.png

thanks

@hotrush
Copy link
Owner

hotrush commented Dec 28, 2017

Sorry, it's not clear for me what images you missed? Check for this snippet

$webshot = new Webshot();
        $png = $webshot
            ->setUrl('https://github.com')
            ->setWidth(1920)
            ->setHeight(1080)
            ->setTimeout(5)
            ->setFullPage(true)
            ->waitForImages()
            ->setImagesLoadingTimeout(30)
            ->saveToPng('github_full', $path);

github_full

Maybe the problem with setFullPage(false)? It will truncate the screenshot to provided width and height?

@ghost
Copy link
Author

ghost commented Dec 28, 2017

I mean, I can not capture some website screen well and correct.
for example , if you try this website :
https://laracasts.com/

you will see screen almost blank , similar to this :

@hotrush
Copy link
Owner

hotrush commented Dec 28, 2017

@webcoweb it may be a phantomjs bug, sometimes it renders sites not correctly. Phantomjs has tons of bugs and open issues, and i am not using it since chrome headless was released. Try for this tool https://github.com/GoogleChrome/puppeteer

@ghost
Copy link
Author

ghost commented Dec 28, 2017

dear Totrush thank you so much, I will try it.
👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant