Drawings on the site gives the script. (Or does not give).
How to correctly otshit wrong request, if there is no picture?
Is it enough just to send a 404 header?

  • You can send a default image 100x100 with the inscription "no image" - Sh4dow
  • Well, you can, of course, but this is not exactly what I would like. A simple drawing that does not return HTTP / 1.1 404 Not Found Date: Sun, 18 Nov 2012 13:07:42 GMT Content-Type: text / html; charset = iso-8859-1 Connection: keep-alive Keep-Alive: timeout = 5 Content-Length: 205 Server: Apache <! DOCTYPE HTML PUBLIC "- // IETF // DTD HTML 2.0 // EN"> <html> <head> <title> 404 Not Found </ title> </ head> <body> <h1> Not Found </ h1> <p> The requested URL /dfg.jpg was not found on this server. </ p> </ body> </ html> That is, in fact, it returns another even. - knes

2 answers 2

In the headers send the code 404, mime-type: image / jpg, and the response body - a picture with the inscription "Image not found". The picture should be in jpeg format, respectively.

Then it will be nice in the browser, and it seems like, by the standard, when receiving 404 code, normal programs usually understand that the requested resource was not found)

    file_exists($urlpic) returns a boolean true or false if the $ urlpic file is present or not, respectively.