https://github.com/thecodeholic/bulkimageresize
Resize all images inside specific folder
https://github.com/thecodeholic/bulkimageresize
Last synced: 3 months ago
JSON representation
Resize all images inside specific folder
- Host: GitHub
- URL: https://github.com/thecodeholic/bulkimageresize
- Owner: thecodeholic
- Created: 2020-02-09T11:41:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T13:05:02.000Z (over 5 years ago)
- Last Synced: 2025-03-21T22:41:28.527Z (3 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bulk Image resize
Using this package you can resize all images inside specific folder## Usage
Put images inside `images` folder and run `php index.php` from the
project's root directory.If you want to integrate this into your project use class ImageResize
```php
$resizer = new ImageResize();
$resizer->resizeAllImages('directory under which you want to resize');
```### Options
```php
// 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');
```### Events
```php
$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');
```### This project is part of the youtube video