How can I find the width of an image using PHP?

前端 未结 7 1675
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 15:40

I was wondering how can I find the width of an image using php.

7条回答
  •  萌比男神i
    2020-12-10 16:06

    As of PHP 7.1 you can do:

    [0 => $width, 1 => $height, 'mime' => $mime] = getimagesize($filename);
    

    This eliminates the need to turn $type into mime-type, while retaining the elegant array style list() assignments.

提交回复
热议问题