Need Help Understanding this PHP Code

前端 未结 5 1519
感情败类
感情败类 2021-01-23 07:48

i am aware of the basics like what is a function, a class, a method etc. however i am totally confused on what exactly the below code does to read the image, i read it somewhere

5条回答
  •  一整个雨季
    2021-01-23 08:41

    PHP's imagecreate* function return a resource. If you want to send it to the client, you'll have to set the appropriate headers and then send the raw image:

    header('Content-Type: image/jpeg');
    imagejpeg($img);
    

    See the GD and Image Functions documentation for details.

提交回复
热议问题