Create Image From Url Any File Type

后端 未结 7 1676
无人及你
无人及你 2020-12-02 17:25

I know of imagecreatefromgif(), imagecreatefromjpeg(), and imagecreatefrompng() but is there a way to create an image resource (for png preferably) from a url of any

7条回答
  •  失恋的感觉
    2020-12-02 18:11

    The simplest way to do this is let php decide what is the file type:

    $image = imagecreatefromstring(file_get_contents($src));
    

提交回复
热议问题