hi,
this is my script to upload and image, change the file extension to lowercase and save the path to my db....to which I need to add a function to resize th image to 750px wide before saving it....please help
$uploadDir = '../uploads/'; if(isset($_POST['upload'])) { fforeach ($_FILES as $file) { $fileName = strtolower($file['name']); $tmpName = $file['tmp_name']; $fileSize = $file['size']; $fileType = $file['type']; if($fileName==""){ $filePath = '../uploads/img/none.jpg'; } else{ $filePath = $uploadDir . $fileName; } ////assigning random name //// get the file extension first $ext = substr(strrchr($fileName, "."), 1); //// make the random file name $randName = md5(rand() * time()); //// and now we have the unique file name for the upload file $filePath = $uploadDir . $randName . '.' . $ext; // Replace spaces with a '_' $filePath = str_replace(" ", "_", $filePath); $result = move_uploaded_file($tmpName, $filePath); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $fileinsert[]=$filePath; }