我正在尝试调整大小,然后使用 php-image-magician 上传图像。但我无法保存图像。请看一下代码:
<!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>
请解释我该怎么做,我做错了什么。
等待你的回复
带着敬意