[英]How to get image size from a canvas?
Is it possible to get the image size in pixels from a canvas? 是否可以从画布获取以像素为单位的图像大小?
Eg I know I can achieve it getting the size from the image directly: 例如,我知道我可以实现直接从图像获取尺寸的方法:
list($width, $height) = @getimagesize($_FILES['inputFieldName']['tmp_name'])
but I want to get it from a canvas. 但我想从画布上得到它。 Eg:
例如:
$canvas = imagecreatefromjpeg($image_path);
//Get image size from $canvas
Try: 尝试:
$canvas = imagecreatefromjpeg($image_path);
$width = imagesx($canvas);
$height = imagesy($canvas);
Details at http://es1.php.net/manual/en/function.imagesx.php and http://es1.php.net/manual/en/function.imagesy.php 有关详细信息,请参见http://es1.php.net/manual/en/function.imagesx.php和http://es1.php.net/manual/en/function.imagesy.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.