gpt4 book ai didi

php - Google pagespeed-insights API 截图解析

转载 作者:行者123 更新时间:2023-12-05 07:21:23 26 4
gpt4 key购买 nike

Google 的 pagespeed-insights API 提供的屏幕截图分辨率似乎很小。我如何在 PHP 中更改分辨率

if($apc_is_loaded) {
apc_fetch("thumbnail:".$url, $use_cache);
}
if(!$use_cache) {
$screen_shot_json_data = file_get_contents("https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=$url&screenshot=true");
$screen_shot_result = json_decode($screen_shot_json_data, true);
$screen_shot = $screen_shot_result['screenshot']['data'];
if($apc_is_loaded) {
apc_add("thumbnail:".$url, $screen_shot, 2400);
}
}
$screen_shot = str_replace(array('_','-'), array('/', '+'), $screen_shot);
$screen_shot_image = "<img src=\"data:image/jpeg;base64,".$screen_shot."\" class='img-responsive img-thumbnail'/>";

最佳答案

In the API (v5) response there is key "final-screenshot", so you can use the data from this key for better resolutionPlease check this link

关于php - Google pagespeed-insights API 截图解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56932344/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com