Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2011, 12:59
konvulsion
 
Fecha de Ingreso: abril-2011
Mensajes: 39
Antigüedad: 13 años
Puntos: 1
¿Qué le falta a este código GD/PHP?

Estoy intentando hacer que una imagen con transparencia se alargue al mismo tamaño que la imagen que se me muestra debajo de la transparencia. He encontrado este código en php.net que parece interesante, pero me muestra la página en blanco...

Código PHP:
Ver original
  1. <?php
  2.     function ImageCopyResampledBicubic(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)  {
  3.         // we should first cut the piece we are interested in from the source
  4.         $src_img = ImageCreateTrueColor($src_w, $src_h);
  5.         imagecopy($src_img, $src_image, 0, 0, $src_x, $src_y, $src_w, $src_h);
  6.  
  7.         // this one is used as temporary image
  8.         $dst_img = ImageCreateTrueColor($dst_w, $dst_h);
  9.  
  10.         ImagePaletteCopy($dst_img, $src_img);
  11.         $rX = $src_w / $dst_w;
  12.         $rY = $src_h / $dst_h;
  13.         $w = 0;
  14.         for ($y = 0; $y < $dst_h; $y++)  {
  15.             $ow = $w; $w = round(($y + 1) * $rY);
  16.             $t = 0;
  17.             for ($x = 0; $x < $dst_w; $x++)  {
  18.                 $r = $g = $b = 0; $a = 0;
  19.                 $ot = $t; $t = round(($x + 1) * $rX);
  20.                 for ($u = 0; $u < ($w - $ow); $u++)  {
  21.                     for ($p = 0; $p < ($t - $ot); $p++)  {
  22.                         $c = ImageColorsForIndex($src_img, ImageColorAt($src_img, $ot + $p, $ow + $u));
  23.                         $r += $c['red'];
  24.                         $g += $c['green'];
  25.                         $b += $c['blue'];
  26.                         $a++;
  27.                     }
  28.                 }
  29.                 ImageSetPixel($dst_img, $x, $y, ImageColorClosest($dst_img, $r / $a, $g / $a, $b / $a));
  30.             }
  31.         }
  32.  
  33.         // apply the temp image over the returned image and use the destination x,y coordinates
  34.         imagecopy($dst_image, $dst_img, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h);
  35.  
  36.         // we should return true since ImageCopyResampled/ImageCopyResized do it
  37.         return true;
  38.     }
  39. ?>

¿Qué parámetros le puede faltar a esto?