편리 avatar

Kakao Vision API 사용을 위한 PHP Client

chicpro

Published: 15 Mar 2018 › Updated: 15 Mar 2018Kakao Vision API 사용을 위한 PHP Client

Kakao Vision API 사용을 위한 PHP Client

img

지난 2018년 3월 7일 공개된 Kakao Vision API 사용을 위한 PHP Client를 개발했다. Vision API를 이용해 이미지의 성인이미지 여부 등을 판별할 수 있다. php-kakao-vision-api 클라이언트는 아래의 Vision API를 지원한다.

composer 를 통한 설치를 지원하며 아래 명령을 통해 설치할 수 있다.

composer require chicpro/php-kakao-vision-api

php-kakao-vision-api 클라이언트를 사용해 썸네일 검출을 처리하는 예제는 아래와 같다.

<?php
//ini_set('display_errors', 1);

require './vendor/autoload.php';

$apiKey = 'REST API Key';

use chicpro\KakaoVision\ThumbnailDetect;

$thumbnail = new ThumbnailDetect();

$thumbnail->setCredentials($apiKey);

$thumbnail->setImageURL('https://example.com/example.jpg');
$thumbnail->setFile('./files/example.jpg');
$thumbnail->setThumbnailSize(100, 100);

$response = $thumbnail->send();

print_r($response);

$apiKeyKakao Developers 에 앱 등록 후 확인할 수 있는 REST API 키로 설정한다. 썸네일 검출에 사용할 이미지의 URL 또는 파일의 경로를 설정한 후 요청을 보내면 결과값이 리턴된다. setImageURLsetFile 중 나중에 호출된 것이 적용되어 요청을 보낸다.

Leave Kakao Vision API 사용을 위한 PHP Client to:

Written by

웹개발자로 그누보드5, 영카트5 개발에 참여했으며 리눅스, 서버(nginx), git, 사진 등에 관심있습니다.

Read more #kr posts


Best Posts From 편리

We have not curated any of chicpro's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From 편리