garry Posted June 1, 2008 Share Posted June 1, 2008 I got some help from you guys last night with manipulating a user supplied image but now I need some more help with updating it. Here's the script if (isset($HTTP_POST_FILES['image'])) { $artistart = $HTTP_POST_FILES['image']; if (!empty($HTTP_POST_FILES['image']) && $artistart['type'] == 'image/jpeg') { $tempimg = $artistart['tmp_name']; $tempsize = getimagesize($tempimg); $width = $tempsize['0']; $height = $tempsize['1']; $imglocation = $imgrow['img']; $thumblocation = $imgrow['thumb']; $filename = DOCUMENT_ROOT . 'artistart/'.$uniq . '.jpg'; $thumbfile = DOCUMENT_ROOT . 'artistart/thumbs/'.$uniq1 . '.jpg'; $newwidth = 300; $newheight = 300; $thumbwidth = 100; $thumbheight = 100; $simg = imagecreatefromjpeg($tempimg); $timg = imagecreatefromjpeg($tempimg); } } I already have imglocation and thumblocation from the database and that is where the two images are located. What I want to know is how I can use PHP to delete the old images and update them with the new ones. Thanks!! Link to comment https://forums.phpfreaks.com/topic/108186-updating-images/ Share on other sites More sharing options...
garry Posted June 1, 2008 Author Share Posted June 1, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/108186-updating-images/#findComment-554579 Share on other sites More sharing options...
chronister Posted June 1, 2008 Share Posted June 1, 2008 <?php $old_image_name = 'some_file_name.jpg'; if(unlink($old_image_name)) { echo 'Image Deleted Successfully'; } else { echo 'Crikey, the damn image is still there'; } ?> Link to comment https://forums.phpfreaks.com/topic/108186-updating-images/#findComment-554665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.