上载和创建缩略图错误php

上载和创建缩略图错误php,php,gd,Php,Gd,我正在为画廊制作我的第一张cms。我想能够上传一个图像到一个文件夹,但在同一时间上传到另一个文件夹相同的图像缩略图。因此,我尝试使用GD的缩略图部分,但我得到以下错误 Warning: move_uploaded_file() expects parameter 1 to be string, resource given in C:\xampp\htdocs\liana\admin_panel\functions\gallery_upload.php on line 49 但它是一个字符串,

我正在为画廊制作我的第一张cms。我想能够上传一个图像到一个文件夹,但在同一时间上传到另一个文件夹相同的图像缩略图。因此,我尝试使用GD的缩略图部分,但我得到以下错误

Warning: move_uploaded_file() expects parameter 1 to be string, resource given in C:\xampp\htdocs\liana\admin_panel\functions\gallery_upload.php on line 49
但它是一个字符串,它是文件的路径

gallery.php

<form action="functions/gallery_upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="file" >
<button type="submit" name="submit"> UPLOAD </button>
</form>

选择要上载的图像:
上载
函数/gallery_upload.php

<?php
//code for image upload, working normally
if (isset($_POST['submit'])){
    $file = $_FILES['file'];
    $fileName = $_FILES['file']['name'];
    $fileTmpName = $_FILES['file']['tmp_name'];
    $fileSize = $_FILES['file']['size'];
    $fileError = $_FILES['file']['error'];
    $fileType = $_FILES['file']['type'];
    $fileExt = explode('.', $fileName);
    $fileActualExt = strtolower(end($fileExt));
    $allowed = array('jpg', 'jpeg', 'png');

    if (in_array($fileActualExt, $allowed)) {
        if ($fileError === 0) { //if there are no errors
            if ($fileSize < 500000) {
                $fileNameNew = uniqid('', true);    
                str_replace(".", "", $fileNameNew);
                $fileNameNew = $fileNameNew.".".$fileActualExt; //change img name based on time
                $fileDestination = '../../gallery/data1/images/'.$fileNameNew;
                move_uploaded_file($fileTmpName, $fileDestination);
        } else {echo 'too big';}} else {echo 'error';}} else {echo 'filetype not allowed';}}


// here I am trying to make the thumbnail

$thumb = resize_image($fileDestination, 200, 200); //I get said error in this line 
move_uploaded_file($thumb,'../../gallery/data1/tooltips/'.$fileNameNew);


// copy pasted function that resizes the image
function resize_image($file, $w, $h, $crop=FALSE) {
    list($width, $height) = getimagesize($file);
    $r = $width / $height;
    if ($crop) {
        if ($width > $height) {
            $width = ceil($width-($width*abs($r-$w/$h)));
        } else {
            $height = ceil($height-($height*abs($r-$w/$h)));
        }
        $newwidth = $w;
        $newheight = $h;
    } else {
        if ($w/$h > $r) {
            $newwidth = $h*$r;
            $newheight = $h;
        } else {
            $newheight = $w/$r;
            $newwidth = $w;}}
    $src = imagecreatefromjpeg($file);
    $dst = imagecreatetruecolor($newwidth, $newheight);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

我刚刚使用了一个名为“wideimage”的插件。我强烈建议,您只需4行代码就可以得到相同的结果

include "path/WideImage.php";
$thumb = WideImage::load($fileDestination);
$resized = $thumb->resize(100, 100);
$resized->saveToFile("path/". $fileNameNew .".jpg");

可能重复的问题怎么会是同一个问题?它显示了一个不同的错误