Превъюшка фоток

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);
что-то ничего не происходит....Подскажите?
 

donflash

Вареник клуба
А чего ты ожидаешь?

-~{}~ 31.08.06 18:42:

Да и вообще этот код устарел, посмотри здесь -> resize
 

rooot

Новичок
Вывод ресайзенного файла, видимо забыл про header ?

-~{}~ 31.08.06 18:43:

ага пасиб
 

donflash

Вареник клуба
Автор оригинала: rooot
Вывод ресайзенного файла, видимо забыл про header ?
И это тоже... Тебе надо делать <img src="ЗДЕСЬ_НАЗВАНИЕ_ЭТОГО_ФАЙЛА.php"> - это правильно!
 
Сверху