PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Martijn Waeyenbergh   PHP Image Optimizer   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: a test file (form to upload image) and set the settings
Class: PHP Image Optimizer
Optimize images adjusting the size and quality
Author: By
Last change:
Date: 1 year ago
Size: 830 bytes
 

Contents

Class file image Download
<?php

require("imageOptimzer.php");

if(isset(
$_POST['optimizePhoto'])){
   
$testImage = new imageOptimzer($_FILES["file"],$_POST['maxWidth'],$_POST['maxHeight'],$_POST['quality']);
}



?>

<h1>Upload an image (jpg/gif/png) and get an optimzed PNG version</h1>
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
    <label for="uitleg" class="control-label">Upload a picture to Optimize</label><br><br>
    max. width: <input type="number" value='1000' name='maxWidth'><br>
    max. height: <input type="number" value='1000' name='maxHeight'><br>
    Quality (0-9): <input type="number" value='9' min=0 max=9 name='quality'><br>
    <input type="file" name="file" id="file"><br><br>
    <input type="submit" name="optimizePhoto" class="btn btn-primary" value="Optimize!">
</form>