1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
// DECOUPPER L'IMAGE NOTE.JPG
//===========================
// Original image
$filename = 'note.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 = 100;
$top = 80;
// This will be the final size of the image (e.g. how many pixels
// left and down we will be going)
//$crop_width = 1400;
//$crop_height = 120;
$crop_width = 1400;
$crop_height = 100;
// 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); |
Partager