1

i notice some webpage display images using php scripts. how do i do that and wats the benefit? forexample: http://static.ak.fbcdn.net/rsrc.php/yp/r/kk8dc2UJYJ4.png

1
  • You need to draw a picture on php? Commented Jan 10, 2011 at 7:42

1 Answer 1

4

Why showing images through PHP might be useful:

  • Being able to control/restrict access to the images in a complex way (e.g. not just by http auth, ip, referer etc.).
  • Being able to dynamically modify images before they are displayed (watermarks for example)

How you do that:

Send the appropriate header for whatver image type (e.g. header('image/png');) you want to show and then output the raw image data, e.g. using readfile()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.