<?php
error_reporting(E_ALL);
$root = './'; // We're here =) ./
include('class.img.inc.es'); // Including the class
$imgman = new ImgMan; //Asign the class
if($_POST['btnsend']){
/* 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
); --*/
$imgman->DoAll($_FILES['images'],$root,null,true);
#ImgMakeThumb: This just creates the thumbnail:
#Use:
/*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
);
*/
$imgman->ImgMakeThumb($source,$max_wh,$font_size,$thumbdir,$font,$delth=false);
#ImgTransform: This will transform the width of the original image.
#Use:
/*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).
#use:
/*SaveImg ($files || Array of $_FILES['imagenes'] or the URL
$folder_to_save || Directory where will saved
);
*/
$imgman->SaveImg($files,$folder_to_save);
#CreatAllNedeedFolders: This will create all the folders needed to save the images, this function depends of "CheckFolders"
#Use:
#CreatAllNedeedFolders ($path || folder where the folders will created, can be root (./) );
$imgman->CreatAllNedeedFolders($path);
#CheckFolders: This function checks if the folder exists, if not will be created
#use:
#CheckFolders($folder || name of the folder)
$imgman->CheckFolders($folder);
#Set: This function sets a value to a variable inside of the class
#uso
/*Set($var || Name of an existing variable inside of the class
$value || New value
)*/
$imgman->Set('var','value');
#ErrorLoger: Show the errors
#use:
#ErrorLoger($array || Errors array)
ErrorLoger($errors);
}
?>
<form action="" method="post" enctype="multipart/form-data">
<label>Imagen(es)</label>
<!-- 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" />
</form>
|