超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<imagecolortransparentimagecopymerge>
Last updated: Fri, 22 Jun 2007

imagecopy

(PHP 3>= 3.0.6, PHP 4 , PHP 5)

imagecopy -- 拷贝图像的一部分

说明

int imagecopy ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)

src_im 图像中坐标从 src_xsrc_y 开始,宽度为 src_w,高度为 src_h 的一部分拷贝到 dst_im 图像中坐标为 dst_xdst_y 的位置上。




add a note add a note User Contributed Notes
imagecopy
jsnell at networkninja dot com
18-Feb-2001 11:09
Want to make an image tile properly?  This is accomplished by swapping all four quadrants of the image.  Here is some sample code that uses imagecopy to do it:

function backgroundify(&$image)
{
$ix = imagesx($image);
$iy = imagesy($image);
$ixhalf = floor($ix / 2); // DON'T USE ON IMAGES WITH ODD SIZES!
$iyhalf = floor($iy /2);
$panel_temp = ImageCreate ($ix, $iy) or die("Cannot Initialize new GD image stream");
imagecopy($panel_temp, $image, 0,0,0,0,$ix, $iy);
imagecopy($image, $panel_temp, 0,0,$ixhalf,$iyhalf, $ix-$ixhalf, $iy-$iyhalf); // move bottom right to top left
imagecopy($image, $panel_temp, $ixhalf,$iyhalf, 0,0,$ix-$ixhalf, $iy-$iyhalf); // top left to bottom right
imagecopy($image, $panel_temp, $ixhalf, 0,0,$iyhalf,$ix-$ixhalf, $iy-$iyhalf); // bottom left to topo right
imagecopy($image, $panel_temp, 0,$iyhalf, $ixhalf,0,$ix-$ixhalf, $iy-$iyhalf); // top left to bottom right
}

<imagecolortransparentimagecopymerge>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22