.Stealth Posted June 1, 2010 Share Posted June 1, 2010 As title, does imagejpeg() overwrite files that already exist with the same filename? I'm writing a gallery script that creates thumbnails of images in a folder. I don't want the script re-making the thumbnails for the images every time the script runs. Do i need to check if the files exist or not in order to create the thumbs or not? Or will PHP ignore it if it exists? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/203584-does-imagejpeg-overwrite/ Share on other sites More sharing options...
The Eagle Posted June 1, 2010 Share Posted June 1, 2010 I thought it would display an error if the name was already taken. Quote Link to comment https://forums.phpfreaks.com/topic/203584-does-imagejpeg-overwrite/#findComment-1066420 Share on other sites More sharing options...
.Stealth Posted June 2, 2010 Author Share Posted June 2, 2010 I'll give it a try. If it does i'll just suppress the error and all should be well. I've not had a chance to run the script yet, only half done. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/203584-does-imagejpeg-overwrite/#findComment-1066422 Share on other sites More sharing options...
Alex Posted June 2, 2010 Share Posted June 2, 2010 Use file_exists to see if a file exists already before recreating it. Quote Link to comment https://forums.phpfreaks.com/topic/203584-does-imagejpeg-overwrite/#findComment-1066434 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.