1. 图片处理代码: source/class/class_image.php
2. 压缩图片 - $imgfile = “sample.jpg”;
-
- require_once libfile('class/image');
- $image = new image;
- $thumbtype = 1; //!< 1:等比例压缩; 2:压缩后裁剪到指定尺寸
- $thumb = $image->Thumb($imgfile,'',50,50,$thumbtype);
- if ($thumb) {
- $target = $image->target; //!< 压缩后的图片文件全路径名
- copy($target, $imgfile);
- unlink($target);
- }
复制代码
|