note 115355 deleted from function.imagecrop by cmb

From: Date: Sun, 09 Oct 2016 11:36:43 +0000
Subject: note 115355 deleted from function.imagecrop by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206812@lists.php.net to get a copy of this message
Note Submitter: nangomusic at gmail dot com ---- An example to crop an image stored in $filename: <?php // Create a blank image and add some text $ini_filename = 'test.JPG'; $im = imagecreatefromjpeg($ini_filename ); $ini_x_size = getimagesize($ini_filename )[0]; $ini_y_size = getimagesize($ini_filename )[1]; //the minimum of xlength and ylength to crop. $crop_measure = min($ini_x_size, $ini_y_size); // Set the content type header - in this case image/jpeg //header('Content-Type: image/jpeg'); $to_crop_array = array('x' =>0 , 'y' => 0, 'width' => $crop_measure, 'height'=> $crop_measure); $thumb_im = imagecrop($im, $to_crop_array); imagejpeg($thumb_im, 'thumb.jpeg', 100); ?>

« previous php.notes (#206812) next »