lincanbin / php-image-resize-class
自动提取上传图像的方形中心部分,并缩放到指定大小。
dev-master
2015-08-16 04:04 UTC
Requires
- php: >=5.2.0
This package is auto-updated.
Last update: 2024-08-28 23:44:58 UTC
README
自动提取上传图像的方形中心部分,并缩放到指定大小。
参数
$UploadAvatar = new ImageResize('FormName'); $Result = $UploadAvatar->Resize(256, 'upload/avatar/large.png', 80); /* 256: the size of the picture to be compressed upload/avatar/large.png: save path 80: Picture quality, 100 indicates no compression. */
示例
从帖子字段调整图像大小
$UploadAvatar = new ImageResize('PostField', 'Avatar'); $Result = $UploadAvatar->Resize(256, 'upload/avatar/large.png', 80);
从Web调整图像大小
$ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_URL, 'https://avatars0.githubusercontent.com/u/5785188?v=3&s=460'); $response = curl_exec($ch); curl_close($ch); $UploadAvatar = new ImageResize('String', $response); $Result = $UploadAvatar->Resize(256, 'upload/avatar/large.png', 80);
许可证
Copyright 2006-2015 Canbin Lin (lincanbin@hotmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.