公有成员 | |
| FLEA_Helper_Image ($handle) | |
| & | createFromFile ($filename, $fileext=null) |
| resize ($width, $height) | |
| resampled ($width, $height) | |
| resizeCanvas ($width, $height, $pos= 'center', $bgcolor= '0xffffff') | |
| crop ($width, $height, $highQuality=true, $nocut=null) | |
| saveAsJpeg ($filename, $quality=80) | |
| saveAsPng ($filename) | |
| saveAsGif ($filename) | |
| destory () | |
| extractColor ($color, $defualt= 'ffffff') | |
公有属性 | |
| $_handle = null | |
| FLEA_Helper_Image::FLEA_Helper_Image | ( | $ | handle | ) |
构造函数 开发者不能直接构造该类的实例,而是应该用 FLEA_Helper_Image::createFromFile() 静态方法创建一个 FLEA_Helper_Image 类的实例。
| resource | $handle |
参考自 createFromFile().
| & FLEA_Helper_Image::createFromFile | ( | $ | filename, | |
| $ | fileext = null | |||
| ) |
从指定文件创建 Image 对象
对于上传的文件,由于其临时文件名中并没有包含扩展名。因此需要采用下面的方法创建 Image 对象:
$ext = pathinfo($_FILES['postfile']['name'], PATHINFO_EXTENSION); $image =& FLEA_Helper_Image::createFromFile($_FILES['postfile']['tmp_name'], $ext);
| string | $filename | |
| string | $fileext |
| FLEA_Helper_Image::resize | ( | $ | width, | |
| $ | height | |||
| ) |
| FLEA_Helper_Image::resampled | ( | $ | width, | |
| $ | height | |||
| ) |
| FLEA_Helper_Image::resizeCanvas | ( | $ | width, | |
| $ | height, | |||
| $ | pos = 'center', |
|||
| $ | bgcolor = '0xffffff' | |||
| ) |
| FLEA_Helper_Image::crop | ( | $ | width, | |
| $ | height, | |||
| $ | highQuality = true, |
|||
| $ | nocut = null | |||
| ) |
在保持图像长宽比的情况下将图像裁减到指定大小
| int | $width | |
| int | $height | |
| boolean | $highQuality | |
| array | $nocut |
参考 extractColor().
| FLEA_Helper_Image::saveAsJpeg | ( | $ | filename, | |
| $ | quality = 80 | |||
| ) |
| FLEA_Helper_Image::extractColor | ( | $ | color, | |
| $ | defualt = 'ffffff' | |||
| ) |
1.5.3