note 62029 deleted from ref.image by tularis

From: Date: Sun, 29 Jun 2008 21:02:42 +0000
Subject: note 62029 deleted from ref.image by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140926@lists.php.net to get a copy of this message
Note Submitter: relsqui at chiliahedron dot com ---- <?php // This is a correction to the image-flipping function I posted previously. // The bitwise ands (&) were incorrectly written as logical ands (&&). // Needless to say, that breaks the function in obnoxious--if amusing--ways. define("VERTICAL", 1); define("HORIZONTAL", 2); function imageflip($image, $mode) { $w = imagesx($image); $h = imagesy($image); $flipped = imagecreate($w, $h); if ($mode & VERTICAL) { for ($y = 0; $y < $h; $y++) { imagecopy($flipped, $image, 0, $y, 0, $h - $y - 1, $w, 1); } } if ($mode & HORIZONTAL) { for ($x = 0; $x < $w; $x++) { imagecopy($flipped, $image, $x, 0, $w - $x - 1, 0, 1, $h); } } return $flipped; } ?>

« previous php.notes (#140926) next »