This article provides a free PHP image processing class: Thumbnail, clipping, fillet, tilt code, he can cut out different styles of pictures oh, haha, more than the other online cut diagram is much better oh.
PHP Tutorial Picture Processing class: Thumbnail, crop, fillet, tilt
Class Resizeimage
{
Type of picture
var $type;
Actual width
var $width;
Actual height
var $height;
The width after the change
var $resize _width;
The height after the change
var $resize _height;
Whether or not to cut the map
var $cut;
Source image
var $srcimg;
Target image Address
var $dstimg;
Fillet source
var $corner;
var $im;
function Resizeimage ($img, $corner, $wid, $hei, $c, $corner _radius, $angle)
{
$this->srcimg = $img;
$this->corner = $corner;
$this->resize_width = $wid;
$this->resize_height = $hei;
$this->cut = $c;
$this->corner_radius = $corner _radius;
$this->angle = $angle;
Type of picture
$this->type = substr (STRRCHR ($this->srcimg, "."), 1);
Initializing an image
$this->initi_img ();
Destination image Address
$this-dst_img ();
//--
$this->width = imagesx ($this->im);
$this->height = Imagesy ($this->im);
Creating images
$this->newimg ();
Imagedestroy ($this->im);
}
function newimg ()
{
The proportions of the altered image
$resize _ratio = ($this->resize_width)/($this->resize_height);
Ratio of actual images
$ratio = ($this->width)/($this->height);
if (($this->cut) = = "1")
Crop chart
{
if ($ratio >= $resize _ratio)
High priority
{
$newimg = Imagecreatetruecolor ($this->resize_width, $this->resize_height);
Imagecopyresampled ($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, (($this Height) * $resize _ratio), $this->height);
$tmp = $this->rounded_corner ($newimg, $this->resize_width);
Imagepng ($tmp, $this->dstimg);
}
if ($ratio < $resize _ratio)
Width first
{
$newimg = Imagecreatetruecolor ($this->resize_width, $this->resize_height);
Imagecopyresampled ($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width , (($this->width)/$resize _ratio));
$tmp = $this->rounded_corner ($newimg);
Imagepng ($tmp, $this->dstimg);
}
}
Else
1 2 3
http://www.bkjia.com/PHPjc/633021.html www.bkjia.com true http://www.bkjia.com/PHPjc/633021.html techarticle This article provides a free PHP image processing class: Thumbnail, clipping, fillet, tilt code, he can cut out different styles of pictures oh, haha, more than the other online cutting diagram is much better oh ...