我正在制作一个刻录图像的脚本。 它正在对 jpgs 工作 。 但是, 是否有一种方法可以将其应用到各种文件类型( bmp、 png、 gif) 的“ 坚固” 上, 没有 " / 坚固 ", 正在经历各种条款?
//create the crop
// Original image
$filename = uploads/ .$image_name;
$endname = uploads/thumbnails/ .$image_name;
// 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 = 0;
$top = 0;
// 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, $crop_width, $crop_height);
imagejpeg($canvas, $endname, 100);
我尝试用 imagecreate
替换 imcreate fromjpeg
, 替换为 imagecreate
, 但无效 。