Пример #1
0
 public function save()
 {
     $args_list = func_get_args();
     $response = "";
     for ($i = 0; $i < count($args_list); $i++) {
         if (empty($args_list[$i])) {
             $response = "Some fields are empty";
             break;
         }
     }
     $basename = basename($this->file['name']);
     $ext = substr($basename, strpos($basename, ".") + 1);
     if (empty($response)) {
         if (in_array($this->name, scandir($this->uploadDir))) {
             $response = "Image with this name already exists in the directory!";
         } else {
             if (move_uploaded_file($this->file['tmp_name'], $this->uploadDir . $basename)) {
                 $magic = new imageLib($this->uploadDir . $basename);
                 $magic->resizeImage($this->width, $this->height, 'exact', true);
                 $magic->saveImage($this->uploadDir . $this->name . "." . $ext, 100);
                 unlink($this->uploadDir . $basename);
                 $response = "Resized image stored as " . $this->uploadDir . $this->name . "." . $ext;
             }
         }
     }
     return $response;
 }
Пример #2
0
function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight = "")
{
    require_once 'php_image_magician.php';
    $magicianObj = new imageLib($imgfile);
    // *** Resize to best fit then crop
    $magicianObj->resizeImage($newwidth, $newheight, 'crop');
    // *** Save resized image as a PNG
    $magicianObj->saveImage($imgthumb);
}
Пример #3
0
function convertPngToBmp($name)
{
    // *** Include PHP Image Magician library
    require_once 'php_image_magician.php';
    // *** Open PNG image
    $magicianObj = new imageLib($name . '.png');
    // *** Save image as a BMP
    $magicianObj->saveImage($name . '.bmp');
}
Пример #4
0
 protected function resize($targetFolder, $file, $beforeName, $x, $y)
 {
     require_once APPPATH . 'i18n/php_image_magician.php';
     $magic = new imageLib($file);
     $magic->resizeImage($x, $y, 1);
     $newfile = $targetFolder . "/" . $beforeName . basename($file);
     $magic->saveImage($newfile);
     $magic_crop = new imageLib($newfile);
     $magic_crop->cropImage($x, $y);
     $magic_crop->saveImage($newfile);
 }
Пример #5
0
function create_img($imgfile, $imgthumb, $newwidth, $newheight = "")
{
    if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
        require_once 'php_image_magician.php';
        $magicianObj = new imageLib($imgfile);
        $magicianObj->resizeImage($newwidth, $newheight, 'auto');
        $magicianObj->saveImage($imgthumb, 80);
        return true;
    } else {
        return false;
    }
}
Пример #6
0
function create_img($imgfile, $imgthumb, $newwidth, $newheight = "", $option = "crop")
{
    $timeLimit = ini_get('max_execution_time');
    set_time_limit(30);
    $result = false;
    if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
        require_once 'php_image_magician.php';
        $magicianObj = new imageLib($imgfile);
        $magicianObj->resizeImage($newwidth, $newheight, $option);
        $magicianObj->saveImage($imgthumb, 80);
        $result = true;
    }
    set_time_limit($timeLimit);
    return $result;
}
Пример #7
0
/*
	As of version 4.2.5 you can now "chain" your image processing for the same
	image. That is, you can process the same image to produce multiple different
	outputs. 
	For example, say you need 3 sizes of an image. By calling reset() after each 
	save, you can freely apply new transformations to produce the next image.
*/
require_once '../php_image_magician.php';
/*	Purpose: Open image
 *	Usage:	 resize('filename.type')
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
// *** Resize and add a border to the first	copy
$magicianObj->resizeImage(300, 200, 'crop');
$magicianObj->addBorder(5, '#f0f0f0');
$magicianObj->addCaptionBox('b', 40, 0, '#000', 50);
$magicianObj->addTextToCaptionBox('Racecar 2000');
$magicianObj->saveImage('output_15.1_a.png', 100);
$magicianObj->reset();
# resets the image resource
// *** Resize and add a border to the second copy
$magicianObj->resizeImage(200, 100, 'crop');
$magicianObj->addBorder(5, '#333');
$magicianObj->saveImage('output_15.1_b.png', 100);
$magicianObj->reset();
# resets the image resource
// *** Resize and add a border to the third	copy
$magicianObj->resizeImage(200, 200, 'crop');
$magicianObj->addBorder(5, '#333');
$magicianObj->saveImage('output_15.1_c.png', 100);
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Add a watermark to your image
 *	Usage:	 addWatermark([watermark_image], [position], [padding])
 * 	Params:	 watermark_image - the image to use as your watermark
 * 			 position - choose from the below options
 * 
 * 				tl = top left,
 * 				t  = top (middle), 
 * 				tr = top right,
 * 				l  = left,
 * 				m  = middle,
 * 				r  = right,
 * 				bl = bottom left,
 * 				b  = bottom (middle),
 * 				br = bottom right
 *
 * 			 padding - This moves the image away from the edges (in pixels)
 *	Output:	 Adds a watermark image to the bottom-right corner, 50px away 
 *  		 from the bottom and right edges, of your image
 */
$magicianObj->addWatermark('sample_images/monkey.png', 'br', 50);
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_4.2.png', 100);
Пример #9
0
<?php

/**
 * Created by Benjaco
 */
include "appdata/conf.php";
$imgname = $_POST['fil'];
$w = $_POST['width'];
$h = $_POST['height'];
include "php_image_magician.class.php";
$magicianObj = new imageLib($folder . $imgname);
$magicianObj->resizeImage($w, $h, 'crop');
$magicianObj->saveImage($folder . $imgname);
echo $w > $h ? 'lanscape' : ($w == $h ? 'kvadradic' : 'protrat');
Пример #10
0
<?php

require_once '../php_image_magician.php';
/*	Purpose: Open image
 *	Usage:	 resize('filename.type')
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Convert image to sepia
 *	Usage:	 sepia()
 * 	Params:	 n/a
 */
$magicianObj->sepia();
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_2.5.png', 100);
Пример #11
0
<?php

require_once '../php_image_magician.php';
/*	Purpose: Open image
 *	Usage:	 resize('filename.type')
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Rotate image
 *	Usage:	 rotate([direction])
 * 	Params:	 direction - choose from the below options
 *
 *				left - rotate the image left (90 degress)
 *				right - rotate the image right (270 degrees)
 *				upside - rotate the image upside down (180 degress)
 */
$magicianObj->rotate('left');
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_3.1.png', 100);
Пример #12
0
 public function manipImageUpload($tableName, $tableIdVal, $sDim = '', $mDim = '', $bDim = '', $exact = false, $isDebug = false, $mbDim = '', $lDim = '', $boDim = '', $resizeType = 'crop')
 {
     //var_dump($this->fileNameNew);
     if ($this->validate(IMG_EXTENSION, IMG_MAX_SIZE)) {
         //if ($this->uploadPhysical(PROJECT_UPLOAD_LRG_PATH, $this->fileNameNew, '', $this->fileNameNew)) {
         if ($this->uploadPhysical(PROJECT_UPLOAD_LRG_PATH, $this->fileNameNew, PROJECT_UPLOAD_LRG_PATH, $this->fileNameNew)) {
             $lWidth = $this->image['width'];
             $lHeight = $this->image['height'];
             $lDimensions = $lWidth . 'x' . $lHeight;
             // *** 1) Initialise / load image
             $resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
             /**
              * Resize copy to PROJECT_UPLOAD_SML_PATH if $sDim passed
              */
             $sWidth = 0;
             $sHeight = 0;
             $sDimensions = '';
             if ($sDim) {
                 $sDimensions = split('x', $sDim);
                 $sWidth = $sDimensions[0];
                 $sHeight = $sDimensions[1];
                 // *** 2) Resize image (options: exact, portrait, landscape, auto, crop)
                 $resizeObj->resizeImage($sWidth, $sHeight, $resizeType);
                 // *** 3) Save image
                 $resizeObj->saveImage(PROJECT_UPLOAD_SML_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$sWidth = round($this->image['widthNew'], 0);
                 //$sHeight = round($this->image['heightNew'], 0);
                 //$sDimensions = $sWidth . 'x' . $sHeight;
             }
             /**
              * Resize copy to PROJECT_UPLOAD_MED_PATH if $mDim passed
              */
             $mWidth = 0;
             $mHeight = 0;
             $mDimensions = '';
             if ($mDim) {
                 $mDimensions = split('x', $mDim);
                 $mWidth = $mDimensions[0];
                 $mHeight = $mDimensions[1];
                 //$resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
                 $resizeObj->resizeImage($mWidth, $mHeight, $resizeType);
                 $resizeObj->saveImage(PROJECT_UPLOAD_MED_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$mWidth = round($this->image['widthNew'], 0);
                 //$mHeight = round($this->image['heightNew'], 0);
                 //$mDimensions = $mWidth . 'x' . $mHeight;
             }
             /**
              * Resize copy to PROJECT_UPLOAD_MEDBIG_PATH if $mbDim passed
              */
             $mbWidth = 0;
             $mbHeight = 0;
             $mbDimensions = '';
             if ($mbDim) {
                 $mbDimensions = split('x', $mbDim);
                 $mbWidth = $mbDimensions[0];
                 $mbHeight = $mbDimensions[1];
                 //$resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
                 $resizeObj->resizeImage($mbWidth, $mbHeight, $resizeType);
                 $resizeObj->saveImage(PROJECT_UPLOAD_MEDBIG_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$mbWidth = round($this->image['widthNew'], 0);
                 //$mbHeight = round($this->image['heightNew'], 0);
                 //$mbDimensions = $mbWidth . 'x' . $mbHeight;
             }
             /**
              * Resize copy to PROJECT_UPLOAD_BIG_PATH if $bDim passed
              */
             if ($bDim) {
                 $bDimensions = split('x', $bDim);
                 $bWidth = $bDimensions[0];
                 $bHeight = $bDimensions[1];
                 //$resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
                 $resizeObj->resizeImage($bWidth, $bHeight, $resizeType);
                 $resizeObj->saveImage(PROJECT_UPLOAD_BIG_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$bWidth = round($this->image['widthNew'], 0);
                 //$bHeight = round($this->image['heightNew'], 0);
                 //$bDimensions = $bWidth . 'x' . $bHeight;
             }
             /**
              * Resize copy to PROJECT_UPLOAD_LRG_PATH if $bDim passed
              */
             if ($lDim) {
                 $lDimensions = split('x', $lDim);
                 $lWidth = $lDimensions[0];
                 $lHeight = $lDimensions[1];
                 //$resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
                 $resizeObj->resizeImage($lWidth, $lHeight, $resizeType);
                 $resizeObj->saveImage(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$lWidth = round($this->image['widthNew'], 0);
                 //$lHeight = round($this->image['heightNew'], 0);
                 //$lDimensions = $lWidth . 'x' . $lHeight;
             }
             if ($boDim) {
                 $boDimensions = split('x', $boDim);
                 $boWidth = $boDimensions[0];
                 $boHeight = $boDimensions[1];
                 //$resizeObj = new imageLib(PROJECT_UPLOAD_LRG_PATH . $this->getNameNew());
                 $resizeObj->resizeImage($boWidth, $boHeight, 'crop');
                 $resizeObj->saveImage(PROJECT_UPLOAD_BO_PATH . $this->getNameNew(), 100);
                 $resizeObj->reset();
                 //$lWidth = round($this->image['widthNew'], 0);
                 //$lHeight = round($this->image['heightNew'], 0);
                 //$lDimensions = $lWidth . 'x' . $lHeight;
             }
             return true;
         } else {
             $_SESSION['errorMsgs'] = "Sorry! An error occured while uploading the file \"{$this->fileName}\"";
             $this->ErrorMsg = "Sorry! An error occured while uploading the file \"{$this->fileName}\"";
             return false;
         }
     } else {
         return false;
     }
 }
Пример #13
0
    case 'xbm':
        imagexbm($img, $imgname);
        break;
    default:
        imagejpeg($img, $imgname);
}
imagedestroy($img);
if ($fastemaal == "1") {
    /*$new_image = imagecreatetruecolor($ny_width, $ny_height);
        $aspect1 = $ny_height / $ny_width;
        $aspect1_o = $ny_width / $ny_height;
        $aspect2 = $after_croped_height / $after_croped_width;
    
        if ($aspect1 < $aspect2) {
            // lut i top og bund
            $start_y_f = round(($start_y/$full_height)*$height);
    
    
            imagecopy($img, $img, 0, $start_y_f, 0, 0, $ny_width, $ny_height);
        } else if ($aspect1 > $aspect2) {
    
        } else {
            imagecopy($img, $img, 0, 0, 0, 0, $ny_width, $ny_height);
        }*/
    include 'php_image_magician.class.php';
    $img = new imageLib($imgname);
    $img->resizeImage($ny_width, $ny_height, 4);
    $img->saveImage($imgname);
}
list($w, $h, $type, $attr) = getimagesize($imgname);
echo json_encode(array("width" => $w, "height" => $h, "class" => $w > $h ? 'lanscape' : ($w == $h ? 'kvadradic' : 'protrat')));
Пример #14
0
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Resize image
 *	Usage:	 resizeImage([width], [height], [resize type], [sharpen])
 * 	Params:	 width - the new width to resize to
 *			 height - the new height to resize to
 *			 resize type - choose from the below options
 *
 *      exact = The exact height and width dimensions you set. (Default)
 *      portrait = Whatever height is passed in will be the height that
 *          is set. The width will be calculated and set automatically 
 *          to a the value that keeps the original aspect ratio. 
 *      landscape = The same but based on the width. We try make the image 
 *         the biggest size we can while stil fitting inside the box size
 *      auto = Depending whether the image is landscape or portrait, this
 *          will automatically determine whether to resize via 
 *          dimension 1,2 or 0
 *      crop = Will resize and then crop the image for best fit
 *	
 *			 sharpen - set as true if you would like shapening applied to 
 *				to your resized image    
 */
$magicianObj->resizeImage(200, 200, 'crop', true);
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_1.2.bmp', 100);
Пример #15
0
             $magic->resizeImage(512, 512, 'crop');
         } else {
             if ($w == '345' && $h == '512') {
                 goto end;
             }
             $magic->resizeImage(345, 512, 'crop');
         }
         break;
     default:
         if ($w == '512' && $h == '512') {
             goto end;
         }
         $magic->resizeImage(512, 512, 'crop');
         break;
 }
 $magic->saveImage($convertFile, 100);
 if ($mime == 'png') {
     unlink($file);
 }
 /**
  * Insert activity log event for images which are resized.
  */
 $log_sql = "INSERT INTO for_log\n                            (`event`, `table`, tag, object, user, created, acknowledged)\n                        VALUES\n                            ('upload',\n                            'extras',\n                            '{$_POST['path']}.jpg',\n                            '{$_POST['subtype']}',\n                            '{$user['email']}',\n                            now(),\n                            null);";
 $log_result = mysqli_query($link, $log_sql);
 if (!$log_result) {
     $events['mysql']['result'] = false;
     $events['mysql']['code'] = mysqli_errno($link);
     $events['mysql']['error'] = mysqli_error($link);
     goto end;
 }
 break;
Пример #16
0
<?php

require_once '../php_image_magician.php';
/*	Purpose: Open image
 *	Usage:	 resize('filename.type')
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Resize image
 *	Usage:	 resizeImage([width], [height], [resize type], [sharpen])
 * 	Params:	 width - the width to crop to
 *			 height - the height to crop to
 *			 crop type 
 *  
 */
$magicianObj->cropImage(150, 150, 'br');
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_1.6.jpg', 100);
Пример #17
0
 public static function resize($path = false, $width = false, $height = false, $save = false)
 {
     require_once ROOT_PATH . "class/editor/filemanager/include/php_image_magician.php";
     require_once ROOT_PATH . "class/editor/filemanager/include/utils.php";
     switch (true) {
         case (empty($width) || $width == 'auto') && (empty($height) || $height == 'auto'):
             return false;
             break;
         case empty($width) || $width == 'auto':
             $option = 1;
             break;
         case empty($height) || $height == 'auto':
             $option = 2;
             break;
         default:
             $option = 0;
             break;
     }
     $path = str_replace(CORE::$cfg['host'], ROOT_PATH, $path);
     $magicianObj = new imageLib($path);
     #$magicianObj->setForceStretch(false);
     $magicianObj->resizeImage($width, $height, $option);
     #$imagick = new Imagick($path);
     #$imagick->resizeImage($width,$height,Imagick::FILTER_LANCZOS,false);
     #$imagick->scaleImage($width,$height);
     $filename = basename($path);
     $file_extension = strtolower(substr(strrchr($filename, "."), 1));
     /*
     switch($file_extension){
         case "gif": $ctype="image/gif"; break;
         case "png": $ctype="image/png"; break;
         case "jpeg":
         case "jpg": $ctype="image/jpeg"; break;
         default:
     }
     
     header('Content-type: '.$ctype);
     */
     #echo $imagick->getImageBlob();
     if (empty($save)) {
         $magicianObj->displayImage($file_extension);
     } else {
         $magicianObj->saveImage($save, 100);
     }
 }
Пример #18
0
     }
     break;
 case 'save_img':
     $info = pathinfo($_POST['name']);
     if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0 || strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0 || $_POST['name'] != fix_filename($_POST['name'], $transliteration, $convert_spaces, $replace_with) || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))) {
         response('wrong data', 400)->send();
         exit;
     }
     $image_data = file_get_contents($_POST['url']);
     if ($image_data === false) {
         response(trans('Aviary_No_Save'), 400)->send();
         exit;
     }
     require_once 'include/php_image_magician.php';
     $magicianObj = new imageLib($_POST['url']);
     $magicianObj->saveImage($current_path . $_POST['path'] . $_POST['name']);
     create_img($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path . $_POST['path'] . $_POST['name'], 122, 91);
     // TODO something with this function cause its blowing my mind
     new_thumbnails_creation($current_path . $_POST['path'], $current_path . $_POST['path'] . $_POST['name'], $_POST['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option);
     break;
 case 'extract':
     if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
         response('wrong path', 400)->send();
         exit;
     }
     $path = $current_path . $_POST['path'];
     $info = pathinfo($path);
     $base_folder = $current_path . fix_dirname($_POST['path']) . "/";
     switch ($info['extension']) {
         case "zip":
             $zip = new ZipArchive();
Пример #19
0
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*	Purpose: Resize image
 *	Usage:	 resizeImage([width], [height], [resize type], [sharpen])
 * 	Params:	 width - the new width to resize to
 *			 height - the new height to resize to
 *			 resize type - choose from the below options
 *
 *      exact = The exact height and width dimensions you set. (Default)
 *      portrait = Whatever height is passed in will be the height that
 *          is set. The width will be calculated and set automatically 
 *          to a the value that keeps the original aspect ratio. 
 *      landscape = The same but based on the width. We try make the image 
 *         the biggest size we can while stil fitting inside the box size
 *      auto = Depending whether the image is landscape or portrait, this
 *          will automatically determine whether to resize via 
 *          dimension 1,2 or 0
 *      crop = Will resize and then crop the image for best fit. You can 
 *			pass in an array with the crop position ("t", "bl", etc) or
 *			the exact position. eg. "50x60".
 *	
 *			 sharpen - set as true if you would like shapening applied to 
 *				to your resized image    
 */
$magicianObj->resizeImage(200, 200, array('crop', 'tr'), true);
$magicianObj->saveImage('output_1.5_a.jpg', 100);
// *** Or
$magicianObj->reset();
$magicianObj->resizeImage(200, 200, 'crop-tr', true);
$magicianObj->saveImage('output_1.5_b.jpg', 100);
Пример #20
0
/**
* Create new image from existing file
*
* @param  string  $imgfile    Source image file name
* @param  string  $imgthumb   Thumbnail file name
* @param  int     $newwidth   Thumbnail width
* @param  int     $newheight  Optional thumbnail height
* @param  string  $option     Type of resize
*
* @return bool
* @throws \Exception
*/
function create_img($imgfile, $imgthumb, $newwidth, $newheight = null, $option = "crop")
{
    $result = false;
    if (file_exists($imgfile) || strpos($imgfile, 'http') === 0) {
        if (strpos($imgfile, 'http') === 0 || image_check_memory_usage($imgfile, $newwidth, $newheight)) {
            require_once 'php_image_magician.php';
            $magicianObj = new imageLib($imgfile);
            $magicianObj->resizeImage($newwidth, $newheight, $option);
            $magicianObj->saveImage($imgthumb, 80);
            $result = true;
        }
    }
    return $result;
}
/*	Purpose: Open image
 *	Usage:	 resize('filename.type')
 * 	Params:	 filename.type - the filename to open
 */
$magicianObj = new imageLib('sample_images/racecar.jpg');
/*
		It's also possible to "stack" transformations. The following is one
		example of many possibilities	
*/
// *** Resize image
$magicianObj->resizeImage(200, 200, 'crop');
// *** Add greyscale
$magicianObj->greyScaleDramatic();
// *** Add white border
$magicianObj->addBorder(25, '#fff');
// *** Add black border
$magicianObj->addBorder(5, '#000');
// *** Add white border
$magicianObj->addBorder(1, '#fff');
// *** Add watermark (bottom, 40px from boarder, 50% opacity)
$magicianObj->addWatermark('sample_images/bear.png', 'tr', 30, 20);
// *** Add text
$magicianObj->addText('Racer', 'b', 10, '#000', 10);
/*	Purpose: Save image
 *	Usage:	 saveImage('[filename.type]', [quality])
 * 	Params:	 filename.type - the filename and file type to save as
 * 			 quality - (optional) 0-100 (100 being the highest (default))
 *				Only applies to jpg & png only
 */
$magicianObj->saveImage('output_8.1.bmp', 100);