无法使用php图像魔术师保存图像

无法使用php图像魔术师保存图像,php,html,Php,Html,我试图调整大小,然后上传一个图像使用php图像魔术师。但我无法保存图像。请看一下代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Upload</title> </head> <body> <?php if (isset($_POST['submit'])) { require_once('

我试图调整大小,然后上传一个图像使用php图像魔术师。但我无法保存图像。请看一下代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Upload</title>
</head>
<body>
<?php

if (isset($_POST['submit'])) {

require_once('php-image-magician/php_image_magician.php');


// *** Step 1 of 2) Set up the variables
$formInputName   = 'img-upload';                            # This is the name given to the form's file input
$savePath        = 'output3';                               # The folder to save the image
$saveName        = 'test';                                  # Without ext
$allowedExtArray = array('.jpg', '.png', '.gif', '.bmp');   # Set allowed file types
$imageQuality    = 100;


// *** If the form has been submitted...    
if (isset($_POST['submit'])) {
$error = '';        

// *** Create object
$magicianObj = new imageLib($formInputName, $savePath, $saveName , $allowedExtArray);

// *** If everything is swell, continue...
if ($umagicianObj->getIsSuccessful()) {
#=------------------------------------------------------------------

// *** Step 2 of 2) Add your image processing code here.

$magicianObj -> resizeImage(100, 100);
$magicianObj -> greyScaleDramatic();

#=------------------------------------------------------------------        
$magicianObj -> saveImage($savepath, $imageQuality);
} else {

// *** If there was an error, save it.
$error = $magicianObj->getError();
}

}
// *** Display
echo '<img src="' . $magicianObj->$savepath() . '">';
}

?>

<!-- The form. Not the name "img-upload" -->
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="img-upload" value="" />
<input type="submit" value="upload" name="submit" />
</form>

</body>
</html>

上传

我想您忘记在中向
$savepath
添加文件名了

saveImage($savepath, ... )
编辑:

它是源代码的一部分:

public function saveImage($savePath, $imageQuality="100")
# Param in:   $savePath: Where to save the image including filename:

您的保存路径应该是精确的图像链接!不仅仅是文件夹名,它还应该包括文件名和格式

尝试:

saveImage($savepath.$savename.".jpg", $imageQuality)