Illusionist
Illusionist

Reputation: 5489

Image loads too slow with header()

I am using a php file which also loads an image. I am using header("location url") to load the image.

My problem is that the image is loading very slowly. If I load it normally, it is much faster.

If I use JavaScript and put the code in the header to load the image, the image loads fast, but then I can't display the picture as an image.

Is there a way to speed the loading time up?

Thanks !

Upvotes: 0

Views: 509

Answers (1)

Dejan Marjanović
Dejan Marjanović

Reputation: 19380

Try like this...

header("Content-Type: image/jpeg");
readfile("image.jpg");

Upvotes: 1

Related Questions