PHP code example of xiebruce / php-get-image-from-clipboard
1. Go to this page and download the library: Download xiebruce/php-get-image-from-clipboard library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xiebruce / php-get-image-from-clipboard example snippets
GetImgFromClipboard\GetImgFromClipboard;
$obj = new GetImgFromClipboard();
switch (PHP_OS){
case 'Darwin':
// For macOS, save screenshot to Desktop
# /Users/youusername/Desktop/ScreenShot.jpg
# /Users/youusername/Desktop/ScreenShot.jpg
$savedImgPath = '/Users/bruce/Desktop/ScreenShot.jpg';
break;
case 'WINNT':
// For Windows, save screenshot to Desktop
# C:\Users\youusername\Desktop\ScreenShot.jpg
# C:\Users\youusername\Desktop\ScreenShot.png
$savedImgPath = 'C:\Users\youusername\Desktop\ScreenShot.png';
case 'Linux':
// For Linux, save screenshot to Desktop
# /home/yourusername/Desktop/ScreenShot.jpg
# /home/yourusername/Desktop/ScreenShot.png
$savedImgPath = '/home/yourusername/Desktop/ScreenShot.jpg';
}
$savedImgPath = $obj->save($savedImgPath);
echo $savedImgPath . "\n";