image-resize/index.php

<?php include '../config.php' ?>
<?php
	session_start();
	$_SESSION['form_token'] = uniqid();
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Image Resize Sample</title>

	<?php include DOCROOT.'header.php' ?>
</head>
<body>
	<h1>Image Resizer</h1>

	<form action="upload.php" method="post" enctype="multipart/form-data">
		<input type="file" name="image" />
		<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MAX_UPLOAD_SIZE ?>" />
		<input type="hidden" name="form_token" value="<?php echo $_SESSION['form_token'] ?>" />
		<input type="submit" value="Resize" />
		</form>

	<p>Max file size: <?php echo to_human(MAX_UPLOAD_SIZE, 0) ?><br>
		The image will be proportionally resized to fit inside a 240 x 180 frame.<br>
		The uploaded file goes in the garbage when afterwards.</p>

	<?php $article = 1564; include DOCROOT.'footer.php'; ?>

</body>
</html>