PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Dodit Suprianto   Simple Image Resizer   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: website test
Class: Simple Image Resizer
Resize images of different formats
Author: By
Last change:
Date: 15 years ago
Size: 983 bytes


Class file image Download

<title>Image Resize</title>


<form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER['SELF'];?>">
    Photo: <input type=file name=photo size="20"><br>
    Proportional: <input type="radio" value="yes" checked name="R1"> <input type="radio" value="no" name="R1"><br>
    Width: <input type="text" name="width" size="20"><br>
    Height: <input type="text" name="height" size="20"><br>
    <input type="submit" name="submit" value="Resize">

if ($_POST['submit'])
        if (
$_POST['R1'] == "yes")
// proportional
$r = new Resize($_FILES['photo']['tmp_name'], $_POST['width'], 0, true);
// or $r = new Resize($_FILE['photo']['tmp_name'], 0, $_POST['height'], true);
} else
// Force the image size
$r = new Resize($_FILES[photo][tmp_name], $_POST[width], $_POST[height], false);