Ver Mensaje Individual
  #15 (permalink)  
Antiguo 08/04/2005, 21:57
eagoweb2
 
Fecha de Ingreso: septiembre-2003
Mensajes: 384
Antigüedad: 23 años
Puntos: 0
Aun utilizando el bufer, que ya lei por cierto de este tipo de procedimeinto, no funciona, no adquiere nada del bufer:

Código PHP:
<?php
ob_start
();
include(
'../inc/conect.php');
// $imgSrc - GD image handle of source image
// $angle - angle of rotation. Needs to be positive integer
// angle shall be 0,90,180,270, but if you give other it
// will be rouned to nearest right angle (i.e. 52->90 degs,
// 96->90 degs)
// returns GD image handle of rotated image.
// la llamada a la función
// Primero tendrás que hacer una consulta a tu BD para obtener la imagen . .es igual el código que ver_thumbnail.php
$sql = "SELECT archivo_binario,archivo_tipo,archivo_nombre FROM archivos WHERE id='".$_GET['id']."'";
    
$consulta = mysql_query($sql,$db_conn);
    
$imagen = mysql_result($consulta,0,"archivo_binario");
$imgSrc= imagecreatefromstring($imagen);
function 
ImageRotateRightAngle( $imgSrc, $angle )
{
   
// ensuring we got really RightAngle (if not we choose the closest one)
   
$angle = min( ( (int)(($angle+45) / 90) * 90), 270 );

   
// no need to fight
   
if( $angle == 0 )
       return( 
$imgSrc );

   
// dimenstion of source image
   
$srcX = imagesx( $imgSrc );
   
$srcY = imagesy( $imgSrc );

   switch( 
$angle )
       {
       case 
90:
           
$imgDest = imagecreatetruecolor( $srcY, $srcX );
           for( 
$x=0; $x<$srcX; $x++ )
               for( 
$y=0; $y<$srcY; $y++ )
                   
imagecopy($imgDest, $imgSrc, $srcY-$y-1, $x, $x, $y, 1, 1);
           break;

       case 
180:
           
$imgDest = ImageFlip( $imgSrc, IMAGE_FLIP_BOTH );
           break;

       case 
270:
           
$imgDest = imagecreatetruecolor( $srcY, $srcX );
           for( 
$x=0; $x<$srcX; $x++ )
               for( 
$y=0; $y<$srcY; $y++ )
                   
imagecopy($imgDest, $imgSrc, $srcY-$y-1, $srcX-$x-1, $x, $y, 1, 1);
           break;
       }

   return( 
$imgDest );
}
$dst_img=ImageRotateRightAngle($imgSrc, $_GET['angulo']);
$binario_contenido = ob_get_contents();
ob_end_clean(); 
$consulta_update = "UPDATE archivos SET archivo_binario = '$binario_contenido' WHERE id='".$_GET['id']."'";
mysql_query($consulta_update,$db_conn) or die("No se pudo actuzalizar los datos en la base de datos."); 
echo 
$binario_contenido;
//header("Location: ver.php?id=".$_GET['id']."");
//exit; 
?>