How to return an image from a php file - Php

image in php

Snippet Code

Rate this page :
  [ 0 votes]

The above line of code changes the header type of the page to the image. So we can call that page in another php page where we want the image to be displayed.

When dealing with images in php, sometimes we require a php page to echo an image. In that condition use the following line of code in the php page. header("Content-type: image/gif/jpeg/png");


Ask Questions

Ask Question