rooot
Новичок
Превъюшка фоток
что-то ничего не происходит....Подскажите?
PHP:
function ResizeGif( $image, $newWidth, $newHeight)
{
//Open the gif file to resize
$srcImage = ImageCreateFromGif( $image );
//obtain the original image Height and Width
$srcWidth = ImageSX( $srcImage );
$srcHeight = ImageSY( $srcImage );
// the follwing portion of code checks to see if
// the width > height or if width < height
// if so it adjust accordingly to make sure the image
// stays smaller then the $newWidth and $newHeight
if( $srcWidth < $srcHeight ){
$destWidth = $newWidth * $srcWidth/$srcHeight;
$destHeight = $newHeight;
}else{
$destWidth = $newWidth;
$destHeight = $newHeight * $srcHeight/$srcWidth;
}
// creating the destination image with the new Width and Height
$destImage = imagecreate( $destWidth, $destHeight);
//copy the srcImage to the destImage
ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight );
//create the gif
ImageGif( $destImage );
//fre the memory used for the images
ImageDestroy( $srcImage );
ImageDestroy( $destImage );
}
ob_start();
ResizeGif( "image.gif", "150", "150");
$resizedImage = ob_get_contents();
ob_end_clean();
print_r($resizedImage);