开发者

GD-PHP: trying to resize an image

开发者 https://www.devze.com 2023-03-24 19:28 出处:网络
I\'m trying to generate a resized image, this is my code: $image = imagecreatefromjpeg($file); $tnImage = imagecreatetruecolor(100, 100);开发者_如何学C

I'm trying to generate a resized image, this is my code:

$image = imagecreatefromjpeg($file);
$tnImage = imagecreatetruecolor(100, 100);开发者_如何学C
imagecopyresampled($tnImage, $image, 0, 0, 0, 0, 100, 100, null, null);

imagejpeg($tnImage, 'thumb', 100) ;

I'm getting the image but it's just black.


http://www.php.net/manual/en/function.imagecopyresampled.php

You need to specify the width and height of the part of the original image you want to copy.

0

精彩评论

暂无评论...
验证码 换一张
取 消