László Zsidi - 2009-02-07 10:46:13 -
In reply to message 1 from Konstantin
Hi,
First of all, the 'thumb' size is not w & h size, this value is a reference value to decrease the image dimension with aspect ratio.
You can use two differences photo types, landscapes and portrait.
The photo is landscape when, if the width of the image is bigger than the height of the image and photo is portarit when, if the height of the image is bigger than the width of the image.
The resize class will be create a new dimension by the 'thumb' value and the w & h attributes /portait or landscape/ and resize image.
Of course you can use this class with a minimal modify:
<?php
/*
*
* => Example Start
*
*/
include "resizeImage.class.php";
/*
*
* => Class constructor
*
*/
$resizeimage = new resizeImage;
/*
*
* => Add image path and new thumb size
*
*/
$full_path = "/" . $_GET [ 'path' ] . "/" . $_GET [ 'subpath' ] . "/" .$_GET [ 'photo' ] . $_GET [ 'mime' ];
$image = $resizeimage -> process ( $full_path, isset ( $_GET [ 'thumb' ] ) ? $_GET [ 'thumb' ] : 90 );
/*
*
* => Set image header
*
*/
header ( 'Content-type:image/' . $_GET [ 'mime' ] );
/*
*
* => Create image
*
*/
switch ( strtolower ( $_GET [ 'mime' ] ) ) {
case "jpeg":
imageJpeg ( $image );
break;
case "jpg":
imageJpeg ( $image );
break;
case "png":
imagePng ( $image );
break;
case "gif":
imageGif ( $image );
break;
}
/*
*
* => Destroy image
*
*/
imageDestroy ( $image );
/*
*
* => Example End
*
*/
?>