note 89658 added to function.imagecopy

From: Date: Wed, 18 Mar 2009 12:38:22 +0000
Subject: note 89658 added to function.imagecopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-152076@lists.php.net to get a copy of this message
I have a few remarks om the mirror-function: The cases horizontal and vertical are switched. 1 = vertical and 2 = horizontal. When I used it there appeared a black lining of 1 pixel on the side or on the top of the picture. To remove it the function becomes as follows: <?php function ImageFlip ( $imgsrc, $mode ) { $width = imagesx ( $imgsrc ); $height = imagesy ( $imgsrc ); $src_x = 0; $src_y = 0; $src_width = $width; $src_height = $height; switch ( $mode ) { case '1': //vertical $src_y = $height -1; $src_height = -$height; break; case '2': //horizontal $src_x = $width -1; $src_width = -$width; break; case '3': //both $src_x = $width -1; $src_y = $height -1; $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: 89.248.170.61 Probable Submitter: 80.101.181.202 ---- Manual Page -- http://www.php.net/manual/en/function.imagecopy.php Edit -- https://master.php.net/note/edit/89658 Del: integrated -- https://master.php.net/note/delete/89658/integrated Del: useless -- https://master.php.net/note/delete/89658/useless Del: bad code -- https://master.php.net/note/delete/89658/bad+code Del: spam -- https://master.php.net/note/delete/89658/spam Del: non-english -- https://master.php.net/note/delete/89658/non-english Del: in docs -- https://master.php.net/note/delete/89658/in+docs Del: other reasons-- https://master.php.net/note/delete/89658 Reject -- https://master.php.net/note/reject/89658 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152076) next »