litebearer Posted May 1, 2010 Share Posted May 1, 2010 I have a small photo gallery. Uploading, resizing and saving the images is no problem. The gallery is setup so that when you click on a thumbnail, it opens a new window with the large version of the picture as well as information regarding the pic (ie possibly a paragraph or two telling about the picture etc). I found a script that on-the-fly creates a new verion of my pic with a dropshadow. It works great, EXCEPT - it uses headers to display the image --- PROBLEM headers already sent. Sooo, I had it save the new image to a temp file (used timestamp for image file name). This works GREAT. No problem with headers. NEW PROBLEM: If I delete the temp file AFTER the code to display the image, it shows the ugly red x. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/200349-image-output-problem/ Share on other sites More sharing options...
ChemicalBliss Posted May 1, 2010 Share Posted May 1, 2010 Make a seperate php script that deals with fetching images. This way you shouldnt have to worry about headers already sent. You get the red X because you deleting the picture before the browser has even received a response from your script (end of script). Or - you could implement an image cache, use image names and ids for the temp names, so if its already been created, dont create it again - but dont delete it either. If you want to delete it you need to know when the user has finished downloading the image, which could be seconds to minutes. You would need to save timestamps into a mysql table and check if the file was made before a certain time period like 10 minutes. -cb- Link to comment https://forums.phpfreaks.com/topic/200349-image-output-problem/#findComment-1051455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.