如何从画布中获取图像大小?

时间:2013-12-11 12:28:57

标签: php image gd

是否可以从画布中获取像素大小?

E.g。我知道我可以直接从图像中获得尺寸:

list($width, $height) = @getimagesize($_FILES['inputFieldName']['tmp_name'])

但我想从画布中获取它。 E.g:

$canvas = imagecreatefromjpeg($image_path);
//Get image size from $canvas

1 个答案:

答案 0 :(得分:1)

尝试:

$canvas = imagecreatefromjpeg($image_path);
$width = imagesx($canvas);
$height = imagesy($canvas);

http://es1.php.net/manual/en/function.imagesx.phphttp://es1.php.net/manual/en/function.imagesy.php

的详细信息