1. Go to this page and download the library: Download gungcahyadipp/file-service 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/ */
FileService::compressImage(
'/path/to/image.jpg',
85, // Quality (1-100)
800, // Max width
600 // Max height
);
use GungCahyadiPP\FileService\FileService;
// Use specific disk
$s3FileService = new FileService('s3');
$localFileService = new FileService('local');
// Save to S3
$s3FileName = $s3FileService->saveFile($file, 'documents', 'contract');
// Save to local storage
$localFileName = $localFileService->saveFile($file, 'temp', 'upload');