note 61751 added to ref.image

From: Date: Fri, 10 Feb 2006 22:17:40 +0000
Subject: note 61751 added to ref.image
Groups: php.notes 
Request: Send a blank email to php-notes+get-103472@lists.php.net to get a copy of this message
Here's an improved version of the image-flipping function I added to the notes for imagecopy(), which in turn was inspired by others that seemed unnecessarily complex. It uses a bitmap for its arguments, so you can specify either direction or both with a bitwise OR. The define()s, of course, are unnecessary but helpful. Please let me know if you have any problems with it. <?php 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; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 66.92.15.102 ---- Manual Page -- http://www.php.net/manual/en/ref.image.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61751 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61751&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61751&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103472) next »