delboy1978uk/image
最新稳定版本:v2.6.2
Composer 安装命令:
composer require delboy1978uk/image
包简介
PHP image class
README 文档
README
A PHP image class utilising the gd library
Installing
composer require delboy1978uk/image
Usage
Instantiation
You can pass a path name into the constructor, or you can use the load() method. Accepts png, jpg, gif, and webp images.
<?php use Del\Image; $image = new Image('/path/to/my.jpg'); // Or... $image = new Image(); $image->load('/path/to/my.png');
Available Methods
<?php use Del\Image; $image = new Image('/path/to/my.jpg'); $image->crop($width, $height, 'center'); // Crops the image, also accepts left or right as 3rd arg $image->destroy(); // remove loaded image in the class. Frees up any memory $image->getHeader(); // returns image/jpeg or equivalent $image->getHeight(); // returns height in pixels $image->getWidth(); // returns width in pixels $image->output(); // output to browser $image->output(true); // passing true returns raw image data string $image->outputBase64Src(); // for use here <img src="HERE" /> $image->resize($width, $height); // resize to the given dimensions $image->resizeAndCrop($width, $height); // resize to the given dimensions, cropping top/bottom or sides $image->save(); // Save the image $image->save('/path/to/save.jpg', $permissions, $compression); // Save as a different image $image->scale(50); // Scale image to a percentage
统计信息
- 总下载量: 4.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-17