lhp/image

There is no license information available for the latest version (dev-master) of this package.

Image library

Maintainers

Details

gitee.com/haiping12132/image.git

Installs: 31

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/lhp/image

dev-master 2022-08-22 02:30 UTC

This package is not auto-updated.

Last update: 2025-12-21 17:17:39 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);