maxso Posted January 25, 2009 Share Posted January 25, 2009 Ok so I want to watermark the images people upload. Here is my script so far. upload.php <? //print_r($_POST); if($_POST["action"] == "Upload Image") { unset($imagename); if(!isset($_FILES) && isset($HTTP_POST_FILES)) $_FILES = $HTTP_POST_FILES; if(!isset($_FILES['image_file'])) $error["image_file"] = "An image was not found."; $imagename = basename($_FILES['image_file']['name']); //echo $imagename; if(empty($imagename)) $error["imagename"] = "The name of the image was not found."; if(empty($error)) { $newimage = "images/" . $imagename; //echo $newimage; $result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage); if(empty($result)) $error["result"] = "There was an error moving the uploaded file."; } } include("upload_form.php"); if(is_array($error)) { while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } } ?> upload_form.php <form method="POST" enctype="multipart/form-data" name="image_upload_form" action="<?$_SERVER["PHP_SELF"];?>"> <p><input type="file" name="image_file" size="20"></p> <p><input type="submit" value="Upload Image" name="action"></p> </form> Where and how could I place my code so that it places a watermark upon upload. Quote Link to comment https://forums.phpfreaks.com/topic/142401-watermarking-on-upload/ Share on other sites More sharing options...
gevans Posted January 25, 2009 Share Posted January 25, 2009 Are you hoping to write your own code, or use existing code?? Quote Link to comment https://forums.phpfreaks.com/topic/142401-watermarking-on-upload/#findComment-746111 Share on other sites More sharing options...
.josh Posted January 26, 2009 Share Posted January 26, 2009 You need to have the watermark image and use the gd library functions to open the target image, superimpose the watermark over the image and save the result back to the image file. Quote Link to comment https://forums.phpfreaks.com/topic/142401-watermarking-on-upload/#findComment-746128 Share on other sites More sharing options...
maxso Posted January 26, 2009 Author Share Posted January 26, 2009 This is an existing code from a tutorial I have used. I have been looking at watermarking gd() tutorials but it hasn't helped me very much. Quote Link to comment https://forums.phpfreaks.com/topic/142401-watermarking-on-upload/#findComment-746359 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.