4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

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 중 나중에 호출된 것이 적용되어 요청을 보낸다.

1 upvotes $0.00

Replies (0)

Conversation

No replies yet

Replies will appear here as people join the conversation.

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: