<?php

// Require and instantiate class (arg: image to manipulate)
require 'class.image_manip.php';
$img = new image_manip('myimage.jpeg');

// Grab a 100x100 portion starting at (0, 0) (top left)
$img->portion(00100100);

// Resize the image (percentage)
$img->resize(70);

// Apply a watermark (save PNGs in Photoshop with 24-bit transparency for best effect)
// Second arg is position - can be either topleft, top, topright, left, centre, right, bottomleft, bottom, bottomright...
$img->watermark('watermark.jpg''topleft')
// ...Or a custom location, again set with coordinates - in this example, 10px in from the top left corner
$img->watermark('watermark2.jpg', array(1010));

// It's badly rendered at diagonal angles and a pretty worthless method, but rotation:
$img->rotate(180);

// Save the image at the default of 75% quality
$img->save('myimage_thumbnail.jpeg');

// Or, we can save it with 100% quality
// Quality must be an integer between 0 and 100 for a JPEG, or 0 and 9 for a PNG
$img->save('myimage_thumbnail.jpeg'false100);

// Save as a PNG with medium quality (as aforementioned, 0-9 on a scale with higher being better)
$img->save('myimage_thumbnail.png''png'6);

// Provides an array of the image's file information (width, height, type, HTML output of width/height)
print_r($img->getinfo());

// Returns the image as a resource for further editing (either outside the class (public) or by extension (protected))
var_dump($img->getimg());

?>