note 91152 added to function.imagecopy

From: Date: Wed, 27 May 2009 14:55:26 +0000
Subject: note 91152 added to function.imagecopy
Groups: php.notes 
Request: Send a blank email to php-notes+get-156080@lists.php.net to get a copy of this message
Simple and basic image cropping: <?php // Original image $filename = 'someimage.jpg'; // Get dimensions of the original image list($current_width, $current_height) = getimagesize($filename); // The x and y coordinates on the original image where we // will begin cropping the image $left = 50; $top = 50; // This will be the final size of the image (e.g. how many pixels // left and down we will be going) $crop_width = 200; $crop_height = 200; // Resample the image $canvas = imagecreatetruecolor($crop_width, $crop_height); $current_image = imagecreatefromjpeg($filename); imagecopy($canvas, $current_image, 0, 0, $left, $top, $current_width, $current_height); imagejpeg($canvas, $filename, 100); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 71.250.233.122 ---- Manual Page -- http://www.php.net/manual/en/function.imagecopy.php Edit -- https://master.php.net/note/edit/91152 Del: integrated -- https://master.php.net/note/delete/91152/integrated Del: useless -- https://master.php.net/note/delete/91152/useless Del: bad code -- https://master.php.net/note/delete/91152/bad+code Del: spam -- https://master.php.net/note/delete/91152/spam Del: non-english -- https://master.php.net/note/delete/91152/non-english Del: in docs -- https://master.php.net/note/delete/91152/in+docs Del: other reasons-- https://master.php.net/note/delete/91152 Reject -- https://master.php.net/note/reject/91152 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156080) next »