Login   Register  
PHP Classes
elePHPant
Icontem

File: imagesample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Senk Jozsef  >  Image  >  imagesample.php  >  Download  
File: imagesample.php
Role: Example script
Content type: text/plain
Description: How to use my image class
Class: Image
Manage and resize uploaded image files
Author: By
Last change: Bug fixed.
Date: 2006-02-02 01:07
Size: 1,771 bytes
 

Contents

Class file image Download
<?php
    
    
include_once "image.php";
    
    
$PrintForm=false;
    if (
$HTTP_POST_FILES['imagefile']) {
        
$image=new Image("./",$HTTP_POST_FILES['imagefile']);
        if (
$image->FType!=null) {
            echo 
$image->GetInfo();
            
$image->Resample("newimage");
        }
        else 
            echo 
'Unsupported file format...';
    }
    else {
        
$PrintForm=true;
    }    
    
    if (
$PrintForm)
        echo 
'
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
            <html>
            <head>
            <title>Image class sample</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <link href="../hun/css/style.css" rel="stylesheet" type="text/css">
            </head>
            <form  name="ImageUpForm" id="ImageUpForm" enctype="multipart/form-data" action="imagesample.php" method="post">
            <table width="380" border="0" align="center" cellpadding="0" cellspacing="6" class="border">
              <tr align="center">
                <td colspan="2" class="cim">Image upload</td>
              </tr>
              <tr>
                <td class="szoveg">Image file </td>
                <td>
                    <input name="imagefile" type="file" class="input" size="40">
                    <input type="hidden" name="MAX_FILE_SIZE" value="1073741824">
                </td>
              </tr>
              <tr align="center">
                <td colspan="2"><input name="Submit" type="submit" class="gomb" value="Upload"></td>
              </tr>
            </table>
            </form>
            </body>
            </html>
        '
;
?>