Exemple #1
0
$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>
		<meta charset="utf-8" />
		<title>Upload</title>
	</head>
	<body>
		<?php 
if ($error != '') {