note 85992 added to function.imagecopy

From: Date: Sat, 27 Sep 2008 12:53:57 +0000
Subject: note 85992 added to function.imagecopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-144835@lists.php.net to get a copy of this message
concerning the previous post of Borszczuk and the function to mirror images: There´s a way better (and faster) method for this task with imagecopyresampled. <?php define ( 'IMAGE_FLIP_HORIZONTAL', 1 ); define ( 'IMAGE_FLIP_VERTICAL', 2 ); define ( 'IMAGE_FLIP_BOTH', 3 ); function ImageFlip ( $imgsrc, $mode ) { $width = imagesx ( $imgsrc ); $height = imagesy ( $imgsrc ); $src_x = 0; $src_y = 0; $src_width = $width; $src_height = $height; switch ( (int) $mode ) { case IMAGE_FLIP_HORIZONTAL: $src_y = $height; $src_height = -$height; break; case IMAGE_FLIP_VERTICAL: $src_x = $width; $src_width = -$width; break; case IMAGE_FLIP_BOTH: $src_x = $width; $src_y = $height; $src_width = -$width; $src_height = -$height; break; default: return $imgsrc; } $imgdest = imagecreatetruecolor ( $width, $height ); if ( imagecopyresampled ( $imgdest, $imgsrc, 0, 0, $src_x, $src_y, $width, $height, $src_width, $src_height ) ) { return $imgdest; } return $imgsrc; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 91.45.56.43 ---- Manual Page -- http://www.php.net/manual/en/function.imagecopy.php Edit -- https://master.php.net/note/edit/85992 Del: integrated -- https://master.php.net/note/delete/85992/integrated Del: useless -- https://master.php.net/note/delete/85992/useless Del: bad code -- https://master.php.net/note/delete/85992/bad+code Del: spam -- https://master.php.net/note/delete/85992/spam Del: non-english -- https://master.php.net/note/delete/85992/non-english Del: in docs -- https://master.php.net/note/delete/85992/in+docs Del: other reasons-- https://master.php.net/note/delete/85992 Reject -- https://master.php.net/note/reject/85992 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144835) next »