ImageCreateFromString and getimagesize in PHP

前端 未结 4 578
我寻月下人不归
我寻月下人不归 2021-02-10 22:36

Currently if a user POST/uploads a photo to my PHP script I start out with some code like this

getimagesize($_FILES[\'picture1\'][\'tmp_name\']);
4条回答
  •  攒了一身酷
    2021-02-10 23:18

    getimagesize can be used with HTTP.

    Filename - It can reference a local file or (configuration permitting) a remote file using one of the supported streams.

    Thus

    $info = getimagesize($url);
    $image = ImageCreateFromString(file_get_contents($url));
    

    should be fine.

提交回复
热议问题