Location: PHPKode > scripts > Imager > imager_test.php
<?php
require "imager.php";

$p = new Imager( new JPEG( 'main.jpg') );

$wu = min( $p->width, $p->height );
for ($i=0; $i<=360; $i+=5) {
	$im = $p->rotate( $i );
	$w = $im->width;
	$h = $im->height;
	$im->crop( ($w-$wu) / 2, ($h-$wu)/2, $wu, $wu )
		->watermark( new Imager( new PNG('skorpalpha.png'), new Transparency( true ) ), Imager::BOTTOM_RIGHT )
		->save( new JPEG('out/' . str_pad( $i, 3, "0", STR_PAD_LEFT ) . '.jpg') );
}

$p->rotate(90)->save( new JPEG('out/' . microtime() . '_90.jpg') );
$p->rotate(180)->save( new JPEG('out/' . microtime() . '_180.jpg') );
$p->rotate(45)->save( new JPEG('out/' . microtime() . '_45.jpg') );
$p->rotate(45, array( 30,60,80 ) )->save( new JPEG('out/' . microtime() . '_452.jpg') );
$p->rotate(270)->save( new JPEG('out/' . microtime() . '_270.jpg') );*/

$p->grayscale()->save( new JPEG('out/' . microtime() . '.jpg') );
$p->negate()->save( new JPEG('out/' . microtime() . '.jpg') );
$p->save( new JPEG('out/' . microtime() . '.jpg') );
$p->blur()->save( new JPEG('out/' . microtime() . '.jpg') );
$p->flipV()->save( new JPEG('out/' . microtime() . 'V.jpg') );
$p->flipH()->save( new JPEG('out/' . microtime() . 'H.jpg') );

$p->watermark( new Imager( new PNG('doggy.png') ), Imager::BOTTOM_RIGHT )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::BOTTOM_LEFT )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::TOP_RIGHT )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::TOP_LEFT )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('skorpalpha.png'), new Transparency( true ) ), Imager::CENTER )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::CENTER )->save( new JPEG('out/' . microtime() . '.jpg') );
$p->watermark( new Imager( new PNG('alphatest.png'), new Transparency( true ) ), Imager::CENTER )->save( new PNG('out/' . microtime() . '.png') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::CENTER )->save( new PNG('out/' . microtime() . '.png') );
$p->watermark( new PNG('doggy.png'), Imager::CENTER )->save( new PNG('out/' . microtime() . '.png') );
$p->watermark( new Imager( new PNG('doggy.png') ), Imager::BOTTOM_LEFT )->save( new PNG('out/' . microtime() . '.png') );
$p->watermark( new Imager( new PNG('ok.png'), new Transparency( array( 51, 255, 51 ) ) ), Imager::BOTTOM_RIGHT )->save( new PNG('out/' . microtime() . '.png') );

$wm = new Imager( new PNG('ok.png'), new Transparency( array( 51, 255, 51 ) ) );
$wm = $wm->resize( 50, 50 );

$p->watermark( $wm, Imager::BOTTOM_RIGHT )->save( new PNG('out/' . microtime() . '.png') );

$p = new Imager( new Canvas( 150, 150, array( 100, 100, 100) ) );
$p = new Imager( new JPEG( 'main.jpg') );
$p->fill( array( 100, 100, 100) )->save( new PNG('out/' . microtime() . '.png') );
$p->thumb( new JPEG( 'main.jpg') )->save( new PNG('out/' . microtime() . '.png') );

$wm = new Imager( new JPEG('main.jpg') );
$wm->addAlpha( new JPEG("mainalpha2.jpg") )->save( new JPEG('out/' . microtime() . '.jpg') );
?>
Return current item: Imager