정밀한 스크린샷 말고 ... 정말 간단하게 페이지의 스크린샷 또는 스냅샷이 필요할 경우
구글 runpagespeed API 를 이용해 보세요.
장점
1.유료 모듈이 아니며 어떠한 클래스 설치가 없이도 사용 가능 합니다.
2.스냅샷이 가능 합니다.
3.키 발급이 필요 없기 때문에 쉽게 사용 가능 합니다.
단점
1.스크린샷 이미지의 너비는 320px 고정입니다.
2.고해상도 스냅샷에는 적합하지 않습니다.
3.Falsh 또는 Java 와 같은 플러그인들은 작동하지 않습니다.
4.복잡한 Javascript 는 거의 작동하지 않습니다.
5.구글을 통해서 스크린샷을 구성하기 때문에 다소 느립니다.
페이지 전체를 캡쳐 할 수 있도록 다음버젼에서 제공되면 느려도 사용할 가치가 충분하다고 봅니다.
<?PHP
$API_URL = "https://www.googleapis.com/pagespeedonline/v4/runPagespeed?";
$SITE_URL = "https://www.naver.com";
$FILTER_THIRD_PARTY_RESOURCES = ""; //default:false
$LOCALE = ""; //default:false
$RULE = ""; //default:false
$SCREENSHOT = "true"; //default:false
$SNAPSHOTS = "true"; //default:false
$STRATEGY = "mobile"; //default:desktop or mobile
$UTM_CAMPAIGN = "";
$UTM_SOURCE = "";
$GOOGLE_PAGESPEED_URL = $API_URL."url=".$SITE_URL."&screenshot=".$SCREENSHOT."&snapshots=$SNAPSHOTS"."&strategy=$STRATEGY";
$googlePagespeedData = file_get_contents($GOOGLE_PAGESPEED_URL); //구글 API 호출
$googlePagespeedData = json_decode($googlePagespeedData, true); //디코드
/*스냅샷 코드 시작*/
foreach( $googlePagespeedData['snapshots'] as $key => $value ) //스냅샷 수만큼 확인하기
{
$screenshot = $value['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
echo "<img src=\"data:image/jpeg;base64,".$screenshot."\" /> <hr>";
}
/*스냅샷 코드 종료*/
/*스크린샷 코드 시작*/
$screenshot = $googlePagespeedData['screenshot']['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
$screenshot64 = str_replace('data:image/jpeg;base64,', '', $screenshot);
$screenshot64 = str_replace(' ', '+', $screenshot64);
echo "<img src=\"data:image/jpeg;base64,".$screenshot."\" />";
/*스크린샷 코드 종료*/
file_put_contents('file.jpg', base64_decode($screenshot64)); //스크린샷 내용을 파일러 저장하기!!
?>
게시글 목록
| 번호 | 제목 |
|---|---|
| 16329 |
node.js
Node.js MongoDB 정렬
|
| 16328 |
node.js
정규 표현식으로 필터링
|
| 16327 |
node.js
환경설정 - dotenv
|
| 16326 |
node.js
Node.js MongoDB 쿼리
|
| 16325 | |
| 16324 |
node.js
nodejs MongoDB Find All
|
| 16323 |
node.js
Node.js MongoDB find
|
| 16322 |
node.js
node.js MongoDB _id Field
|
| 16321 |
node.js
node.js MongoDB 여러 문서 삽입
|
| 16320 |
node.js
Node.js MongoDB Insert
|
| 16319 |
node.js
Node.js MongoDB 컬렉션 만들기
|
| 16318 |
node.js
Node.js MongoDB 데이터베이스 생성
|
| 16317 |
node.js
Node.js MongoDB 설치
1
|
| 16316 |
node.js
Node.js 전자 메일 보내기
|
| 16315 |
node.js
Node.js 파일 업로드
|
| 16310 |
node.js
node.js 이벤트 모듈
|
| 16309 |
node.js
node.js NPM
|
| 16308 |
node.js
node.js 파일삭제, 파일 이름 바꾸기
|
| 16305 |
node.js
nodejs 기초문법 - 클래스
3
|
| 16304 |
node.js
nodejs 기초문법 - 조건문 반복문
|
| 16303 |
node.js
nodejs .기초문법 변수선언 , 함수선언
|
| 16302 |
node.js
nodejs 파일 업데이트
|
| 16301 |
node.js
nodejs 파일 만들기
|
| 16300 |
node.js
nodejs 파일 읽기
1
|
| 16299 |
node.js
Node.js 쿼리 문자열 읽기 , 쿼리 문자열 분할하기
|
| 16298 |
node.js
NOde.js HTTP 모듈
|
| 16297 |
node.js
Node.js 모듈
|
| 16295 |
node.js
nods.js 시작하기
|
| 16294 |
node.js
node.js 란 2번째
|
| 16293 |
node.js
Node.js란
1
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기