- PHP Identicon 라이브러리 설치
1 사전작업[ | ]
2 CLI 예시[ | ]
Console
Copy
testuser@localhost:~$ mkdir project1
testuser@localhost:~$ cd project1/
testuser@localhost:~/project1$ composer require yzalis/identicon:1.2.0
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing yzalis/identicon (1.2.0): Downloading (100%)
Writing lock file
Generating autoload files
Console
Copy
testuser@localhost:~/project1$ vi test.php
PHP
Copy
<?php
require 'vendor/autoload.php';
$identicon = new \Identicon\Identicon();
$imageData = $identicon->getImageData('bar');
file_put_contents('bar.png', $imageData);
Console
Copy
testuser@localhost:~/project1$ php identicon_test.php
testuser@localhost:~/project1$ ll bar.png
-rw-rw-r-- 1 testuser testuser 250 Jul 1 13:46 bar.png
- 트러블슈팅:
PHP Fatal error: Uncaught Exception: GD does not appear to be available in your PHP installation.
나오면 php-gd 설치
3 웹서버 예시[ | ]
Console
Copy
testuser@localhost:~$ cd /var/www/html/
testuser@localhost:/var/www/html$ composer require yzalis/identicon:1.2.0
... (생략)
testuser@localhost:/var/www/html$ vi identicon_test.php
PHP
Copy
<?php
include 'vendor/autoload.php';
$identicon = new \Identicon\Identicon();
$identicon->displayImage('foo');
- http://서버주소/identicon_test.php 접속하여 확인
4 같이 보기[ | ]
5 참고[ | ]
편집자 Jmnote 203.244.212.21 Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.