如何从画布中获取图像大小? [英] How to get image size from a canvas?
本文介绍了如何从画布中获取图像大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从画布中获取像素大小?
Is it possible to get the image size in pixels from a canvas?
例如。我知道我可以直接从图像中获得尺寸:
E.g. 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. E.g.:
$canvas = imagecreatefromjpeg($image_path);
//Get image size from $canvas
推荐答案
尝试:
$canvas = imagecreatefromjpeg($image_path);
$width = imagesx($canvas);
$height = imagesy($canvas);
http://es1.php.net/manual/en/function.imagesx.php 和 http://es1.php.net/manual/en/function.imagesy.php
这篇关于如何从画布中获取图像大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文