我在上传到服务器之前编写了一个调整图像大小的代码..但我也想创建一个缩略图并将其发送到缩略图文件夹。此代码调整图像大小并成功将其发送到服务器但我无法找到同时创建缩略图的方法..请帮助..谢谢..
<?php
echo"
<form action='denek1.php' method='POST' enctype='multipart/form-data'>
<input type='file' name='upload' />
<input type='submit' name='submit' value='Upload File' />
</form>";
if(isset($_POST['submit'])){
$isize='500'; $ipath='ul/';
$image_path=$_FILES['upload']['tmp_name'];
$image_name=$_FILES['upload']['tmp_name'];
$extget=$_FILES['upload']['name'];
$ext = pathinfo($extget, PATHINFO_EXTENSION);
$ext = strtolower($ext);
if($ext=='png'){
$src = imagecreatefrompng($image_path);}
if($ext=='jpg' || $ext=='jpeg'){
$src = imagecreatefromjpeg($image_path);}
list($width, $height) = getimagesize($image_path);
$newwidth = $isize;
$newheight = ($height / $width) * $newwidth;
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0,0,0,0, $newwidth, $newheight, $width, $height);
$shuf=range(1, 999999);
$shuf1= array_rand($shuf);
$image_name = sha1($image_name).$shuf1.".jpg";
imagejpeg($tmp, $ipath.$image_name, 100);
$newpath = $ipath.$_FILES['upload']['name'];
move_uploaded_file($_FILES['upload'][$tmp], $ipath.$_FILES['upload']['name']);
imagedestroy($src);
imagedestroy($tmp);
}
?>