PHP code example of thecodeholic / bulk-image-resize
1. Go to this page and download the library: Download thecodeholic/bulk-image-resize 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/ */
thecodeholic / bulk-image-resize example snippets
$resizer = new ImageResize();
$resizer->resizeAllImages('directory under which you want to resize');
// The image width which will be used to create thumbnails
$imageWidth = 128;
// Extensions to check each file against before trying to resize
$extensions = ['jpg', 'png'];
$resizer = new ImageResize($imageWidth, $extensions);
$resizer->resizeAllImages('directory under which you want to resize');
$resizer = new ImageResize($imageWidth, $extensions);
// Before resizing the image
$resizer->onBeforeResize(function($path){
echo "Before resize " . $path . PHP_EOL;
});
// After resizing the image
$resizer->onAfterResize(function($path){
echo "After resize " . $path . PHP_EOL;
});
$resizer->resizeAllImages('directory under which you want to resize');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.