PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Andrés Ortiz  >  ImgMan  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File
Class: ImgMan
Process multiple images at once
Author: By
Last change: - Explain all the features.
- Zero errors (error_reporting) active.
Date: 8 years ago
Size: 3,141 bytes


Class file image Download
$root = './'; // We're here =) ./
include(''); // Including the class
$imgman = new ImgMan; //Asign the class
/* Everything what we need to start, is use the function DoAll, this will do everything: Save the image(s), Make the Thumb, Transform Image, etc */
        /* Then you can start to touch each function =) */
        /* -- DoAll (array || Array of $_FILES['imagenes']
                     folder || Folder where the images will saved
                     width || New width for each image
                     debug || Debug, if error exists
              ); --*/
#ImgMakeThumb: This just creates the thumbnail:
        /*ImgMakeThumb ($source || URL of the image
                        $max_width || Width of Thumbnail
                        $font_size || Size of the font
                        $thumbdir || Directory of the thumbnails
                        $name_font || URL of the font
                        $delete_thb || Delete existing thumb, true or false

#ImgTransform: This will transform the width of the original image.
        /*ImgTransform ($source || URL of the image
                        $width || New width of the image
                        $save_path || Directory where will saved
                        $quality || Quality (1 - 100) by default: 80
$imgman->ImgTransform($source,$width,$save_path ,$quality='80');

#SaveImg: This function will save the image(s).
        /*SaveImg ($files || Array of $_FILES['imagenes'] or the URL
                   $folder_to_save || Directory where will saved

#CreatAllNedeedFolders: This will create all the folders needed to save the images, this function depends of "CheckFolders"
        #CreatAllNedeedFolders ($path || folder where the folders will created, can be root (./) );

#CheckFolders: This function checks if the folder exists, if not will be created
        #CheckFolders($folder || name of the folder)

#Set: This function sets a value to a variable inside of the class
        /*Set($var || Name of an existing variable inside of the class
              $value || New value

#ErrorLoger: Show the errors
        #ErrorLoger($array || Errors array)

<form action="" method="post" enctype="multipart/form-data">
    <!-- What ever you want -->
    <input type="file" name="images[]" /> <br />
    <input type="file" name="images[]" /> <br />
    <input type="file" name="images[]" /> <br />
    <input type="file" name="images[]" /> <br />
    <input type="submit" name="btnsend" />