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

This package is not auto-updated.

Last update: 2025-06-22 14:57:32 UTC


README

介绍

图片缩放

  1. 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);