php_write_logo_picture1.php- <html>
- <head>
- <title>ShotDev.Com Tutorial</title>
- </head>
- <body>
- <form action="php_write_logo_picture2.php" method="post" enctype="multipart/form-data" name="frmMain">
- <table width="343" border="1">
- <tr>
- <td>Upload</td>
- <td><input name="fileUpload" type="file"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="Submit" value="Submit"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <!--- This file download from www.shotdev.com -->
php_write_logo_picture2.php- <html>
- <head>
- <title>ShotDev.Com Tutorial</title>
- </head>
- <body>
- <?
- if(trim($_FILES["fileUpload"]["tmp_name"]) != "")
- {
- $myImage = imagecreatefromjpeg($_FILES["fileUpload"]["tmp_name"]);
- $myCopyright = imagecreatefromgif('logo.gif');
-
- copy($_FILES["fileUpload"]["tmp_name"],"MyResize/".$_FILES["fileUpload"]["name"]);
- $destWidth = imagesx($myImage);
- $destHeight = imagesy($myImage);
- $srcWidth = imagesx($myCopyright);
- $srcHeight = imagesy($myCopyright);
-
- $destX = ($destWidth - $srcWidth) / 2;
- $destY = ($destHeight - $srcHeight) / 1;
- $white = imagecolorexact($myCopyright, 255, 255, 255);
- imagecolortransparent($myCopyright, $white);
-
- imagecopymerge($myImage, $myCopyright, $destX, $destY, 0, 0, $srcWidth, $srcHeight, 50);
-
- imagedestroy($myImage);
- imagedestroy($myCopyright);
- }
- ?>
- <b>Original</b><br>
- <img src="<?="MyResize/".$_FILES["fileUpload"]["name"];?>">
- <hr>
- <b>New Images</b><br>
- <img src="<?="MyResize/image.png";?>">
- </body>
- </html>
- <!--- This file download from www.shotdev.com -->
Den viser kun originalen og ikke dens resize, det vil også sige den uploader kun 1 fil. I original.
Har blot lagt det op som beskrevet på deres side, og sat 0777 til mappen.
Download fra http://www.shotdev.com