Пример #1
0
$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
    $uploadObj = new imageUpload($formInputName, $savePath, $saveName, $allowedExtArray);
    // *** If everything is swell, continue...
    if ($uploadObj->getIsSuccessful()) {
        #=------------------------------------------------------------------
        // *** Step 2 of 2) Add your image processing code here.
        $uploadObj->resizeImage(100, 100, 'crop');
        $uploadObj->greyScaleDramatic();
        #=------------------------------------------------------------------
        $uploadObj->saveImage($uploadObj->getTargetPath(), $imageQuality);
    } else {
        // *** If there was an error, save it.
        $error = $uploadObj->getError();
    }
}
?>
<!DOCTYPE html>
<html lang="en">
	<head>