I'm going to try this. Regarding program flow, I'm assuming that the creation and test for the file name would come in somewhere after I've fetched the data from the database and the print link_pic($fn); would be sent to the HTML display. Is that correct? Thanks.