File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 41
41
$ fileLocation = 'test ' ;
42
42
$ screen ->save ($ fileLocation );
43
43
44
+ header ("Cache-Control: no-cache, no-store, must-revalidate " ); // HTTP 1.1.
45
+ header ("Pragma: no-cache " ); // HTTP 1.0.
46
+ header ("Expires: 0 " ); // Proxies.
44
47
header ('Content-Type: ' . $ screen ->getImageType ()->getMimeType ());
45
48
header ('Content-Length: ' . filesize ($ screen ->getImageLocation ()));
46
49
readfile ($ screen ->getImageLocation ());
Original file line number Diff line number Diff line change 14
14
page.settings.resourceTimeout = <?php echo $ timeout ?> ;
15
15
<?php endif ?>
16
16
17
- page.open('<?php echo $ url ?> ', function () {
17
+ page.open('<?php echo $ url ?> ', function (status) {
18
+ if (status !== 'success') {
19
+ console.log('Unable to load the address!');
20
+ phantom.exit(1);
21
+ }
18
22
19
23
<?php if (isset ($ includedJsScripts )) : ?>
20
24
<?php foreach ($ includedJsScripts as $ script ) : ?>
21
25
page.injectJs('<?php echo $ script ?> ');
22
26
<?php endforeach ?>
23
27
<?php endif ?>
24
28
25
- /* This will set the page background color white */
26
29
page.evaluate(function() {
27
30
<?php if (isset ($ backgroundColor )) : ?>
28
- document.body.bgColor = '<?php echo $ backgroundColor ?> ';
31
+ /* This will set the page background color */
32
+ if (document && document.body) {
33
+ document.body.bgColor = '<?php echo $ backgroundColor ?> ';
34
+ }
29
35
<?php endif ?>
30
36
31
37
<?php if (isset ($ includedJsSnippets )) : ?>
You can’t perform that action at this time.
0 commit comments