[php]imagecrop php原生裁圖函數
<?php
// Create a blank image and add some text
$ini_filename = 'test.JPG';
$im = imagecreatefromjpeg($ini_filename);
//裁圖尺寸
$ini_x_size = 300;
$ini_y_size = 400;
// Set the content type header - in this case image/jpeg
//header('Content-Type: image/jpeg');
$to_crop_array = array('x' =>0 , 'y' => 0, 'width' => $ini_x_size,'height'=> $ini_y_size);
$thumb_im = imagecrop($im, $to_crop_array);
imagejpeg($thumb_im, 'thumb.jpeg', 100);
?>
全站熱搜