-
-
Save jaseclamp/d4ac6205db352e822ff6 to your computer and use it in GitHub Desktop.
| <?php | |
| $sites = "http://www.broadcastsolutions.com.au/ | |
| http://www.kvm.com.au/ | |
| http://www.ambertech.com.au/"; | |
| $sites = preg_split('/\r\n|\r|\n/', $sites); | |
| echo " | |
| <style> | |
| img {float: left; margin: 15px; } | |
| </style> | |
| "; | |
| foreach($sites as $site) | |
| { | |
| //cache it | |
| if ( !$image = apc_fetch( "thumbnail:".$site ) ) | |
| { | |
| $image = file_get_contents("https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=$site&screenshot=true"); | |
| $image = json_decode($image, true); | |
| //echo "<pre>"; print_r($image); die; | |
| $image = $image['screenshot']['data']; | |
| apc_add("thumbnail:".$site, $image, 2400); | |
| } | |
| $image = str_replace(array('_','-'),array('/','+'),$image); | |
| echo "<img src=\"data:image/jpeg;base64,".$image."\" border='1' />"; | |
| } | |
| ?> |
skywebdeveloper, remove line 19 and 27.
This is excellent!! Any way to make it grab a larger screenshot?
Brilliant, Just what I needed! Upvoted your comment on SO too
Wow. Thanks.
How to generate the Image to the file and get the file name ?
or
How to combine the Image to the Facebook Feed Dialog ?
Thanks, can this get full webpage?
Great idea! Thx !
Excellent resource,
I'm having an issue, it returns an error 'cause the & is been converted to & anyone else is having the same issue?
Thanks in advance
does this no longer work?
How can I download the image ?
Fatal error: Call to undefined function apc_fetch() in F:\xampp\htdocs\cv\a.php on line 19
How am i supposed to solve this ?
Very useful! Thank you.
how can i get full width and height?
How can I download the image ?
$rute = "img/pic.jpeg";
// decode base64
$pdf_b64 = base64_decode($screenshot);
// you record the file in existing folder
if(file_put_contents($rute, $pdf_b64)){
header("Content-type:image/jpeg");
}
Fatal error: Call to undefined function apc_fetch() in F:\xampp\htdocs\cv\a.php on line 19
How am i supposed to solve this ?
### code be like below
//if ( !$image = apc_fetch( "thumbnail:".$site ) ) >>remove
$image = file_get_contents("https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=$site&screenshot=true");
$image = json_decode($image, true);
$image = $image['screenshot']['data'];
// apc_add("thumbnail:".$site, $image, 2400); >> remove
Fatal error: Call to undefined function apc_fetch() in D:\Local server\htdocs\localhost\datsun\test\test.php on line 19
### code be like below
//if ( !$image = apc_fetch( "thumbnail:".$site ) ) >>remove
$image = file_get_contents("https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=$site&screenshot=true");
$image = json_decode($image, true);
$image = $image['screenshot']['data'];
// apc_add("thumbnail:".$site, $image, 2400); >> remove
Or you install the apc package.
Fatal error: Call to undefined function apc_fetch() in D:\Local server\htdocs\localhost\datsun\test\test.php on line 19