lhp / image
There is no license information available for the latest version (dev-master) of this package.
Image library
dev-master
2022-08-22 02:30 UTC
Requires
- php: >=8.0
- ext-fileinfo: *
Requires (Dev)
- phpunit/phpunit: ^4.8 || ^5.7 || ^7.5.15
Suggests
- ext-gd: to use GD library based image processing.
This package is not auto-updated.
Last update: 2025-05-25 14:36:31 UTC
README
介绍
图片缩放
- xxxx
使用说明
use Lhp\Image\Gd\Driver;
$img = (new Driver())->init($image);
$height = $img->getWidth();
$width = $img->getHeight();
$wHRate = $width / $height;
$basename = basename($image);
$medium = $img->resize(400, 400 * $wHRate);
$medium->save(str_replace($basename, 'medium-'.$basename, $image), 90);
$small = $img->resize(250, 250 * $wHRate);
$small->save(str_replace($basename, 'small-'.$basename, $image), 90);