Created
July 17, 2014 02:36
-
-
Save jaseclamp/d4ac6205db352e822ff6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' />"; | |
} | |
?> |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$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");
}