A: 

Any particular reason why you can't just use http://us2.php.net/manual/en/function.imagejpeg.php

Azeem.Butt
Mostly because file_get_contents is working fine. Also, I'd like to avoid using GD image library as it will only slow down my script.
Bloudermilk
If it were working fine this thread wouldn't exist.
Azeem.Butt
+1  A: 

I can't say why Safari is treating your images as attachments/downloads. I actually tested it in the latest Safari 4 on SL and it works OK. You could try sniffing the HTTP conversation and make sure no extra headers (e.g. content-disposition) are creeping in. Also it may pay to check over Safari config settings, maybe something subtle is different there to your other browsers?

On the topic of performance:

First I would try to eliminate the PHP altogether. See if you can leverage your webserver's modules/configuration to achieve your goal.

If you can't do without the PHP, then you could try letting the webserver handle the actual delivery. You can do this in nginx with X-Accel-Redirect and in lighttpd and apache with X-Sendfile.

oops
+1 I agree, try sniffing headers when requesting a normal image, and when requesting it through php, and check if there's a difference
Sune Rievers