asked on
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> •¾ÎÆÅ»»¿:
<input name="new_image" value="‘½±¶®Ä·Ã·" id="new_image" size="30" type="file" class="fileUpload" />
<button name="submit" type="submit" class="submitButton"> Á¿Ã¸®º· •¾ÎÆÅ»»¿Å</button> <strong> ¡Ÿ£Ÿ§—: — ¿½¿¼±Ã¯± ĿбÁǵ¯¿Å ÀÁÀµ¹ ½± µ¯½±¹ "test.jpg" ³¹± ½± »µ¹Ä¿ÅÁ³®Ãµ¹ ÃÉÃĬ</strong>
</form>
<?php
if(isset($_POST['submit'])){
if (isset ($_FILES['new_image'])){
$imagename = $_FILES['new_image']['name'];
$source = $_FILES['new_image']['tmp_name'];
$target = "images/".$imagename;
move_uploaded_file($source, $target);
$imagepath = $imagename;
$save = "../images/" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 703;
$diff = $width / $modwidth;
$modheight = 928;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
echo "<img src='../images/".$imagepath."'><br>";
}
}
$path_to_images = "../images/";
echo '<img src="'.$path_to_images.'test.jpg" />';
?>