dououde4065 2013-12-11 12:28
浏览 281
已采纳

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

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
  • 写回答

1条回答 默认 最新

  • doufei6456 2013-12-11 12:50
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?