My IE lets me download all your pictures as JPG automatically. It also works with Firefox.
However, here are some tips that will probably fix your problem.
- Add "\n" to all your header calls.
- Remove htmlentities().
- Add a space between "Content-Disposition:" and $disposition (I don't know if this one really matters)
header("Cache-Control: no-cache, must-revalidate\n");
header("Pragma: no-cache\n");
header("Content-Type: ".$mime."\n");
header("Content-Disposition: $disposition; filename=\"".trim($name)."\"\n");
header("Content-Description: ".trim($name)."\n");
header("Content-Length: ".(string)(filesize($path))."\n");
header("Connection: close\n");
Also, I don't think you should have the "Cache-control" headers for the image. I believe you use those for web page headers. Try taking those two lines out and use them in the start of every page. I have no idea what the "Connection: close" is supposed to do, but see if removing that helps.
I don't know for sure if any of the above suggestions will help, but keep playing around until you have what you want. And if nothing works, I apologize for wasting your time. 😃