A
Anonymous
Guest
Took me ages to figure this out so here it is along with keywords for search engines...
Streaming PHP image files (jpg, jpeg, gif) with original filenames rather than PHP file's name. Uses content headers, disposition, location, content-type.
Code:
# Tell the broswer that the file coming up is Jpeg/Jpg
header("Content-Type: image/jpeg");
# Tell the browser to assign the file a proper name isntead of the PHP file's name
header("Content-Disposition: inline; filename=\"$ImgName\"");
# Direct the browser to the image itself
header("location: $image_path");
Streaming PHP image files (jpg, jpeg, gif) with original filenames rather than PHP file's name. Uses content headers, disposition, location, content-type.