note 11361 added to ImageCopy

From: Date: Sun, 18 Feb 2001 00:09:55 +0000
Subject: note 11361 added to ImageCopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-11193@lists.php.net to get a copy of this message
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 } http://www.php.net/manual/en/function.imagecopy.php

« previous php.notes (#11193) next »