Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/06/2011, 15:49
Avatar de hackcrack
hackcrack
 
Fecha de Ingreso: abril-2011
Mensajes: 331
Antigüedad: 15 años, 7 meses
Puntos: 9
Dar fondo transparente - GD

Hola tengo el siguiente codigo que me genera una imagen con los bordes en curva, pero estoy intentando que el fondo donde esta la curva sea transparente pero siempre termina como blanco , si alguien me puede ayudar plis.

Este es el codigo

Código PHP:
<?php
$juego 
= $_POST['nombre'];

$corner_radius = isset($_GET['radius']) ? $_GET['radius'] : 10; // The default corner radius is set to 20px
$topleft = (isset($_GET['topleft']) and $_GET['topleft'] == "no") ? false : true; // Top-left rounded corner is shown by default
$bottomleft = (isset($_GET['bottomleft']) and $_GET['bottomleft'] == "no") ? false : true; // Bottom-left rounded corner is shown by default
$bottomright = (isset($_GET['bottomright']) and $_GET['bottomright'] == "no") ? false : true; // Bottom-right rounded corner is shown by default
$topright = (isset($_GET['topright']) and $_GET['topright'] == "no") ? false : true; // Top-right rounded corner is shown by default

$corner_source = imagecreatefrompng('http://www.assemblysys.com/dataServices/images/rounded_corner.png');

$corner_width = imagesx($corner_source);  
$corner_height = imagesy($corner_source);  
$corner_resized = ImageCreateTrueColor($corner_radius, $corner_radius);
ImageCopyResampled($corner_resized, $corner_source, 0, 0, 0, 0, $corner_radius, $corner_radius, $corner_width, $corner_height);


$corner_width = imagesx($corner_resized);  
$corner_height = imagesy($corner_resized);  
$image = imagecreatetruecolor($corner_width, $corner_height);  
$image = imagecreatefromjpeg($juego);
$size = getimagesize($juego);

// Top-left corner
    
$dest_x = 0;  
    
$dest_y = 0;  
imagealphablending($image, false);
imagesavealpha($image, true);
    
imagecopymerge($image, $corner_resized, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);

    
$dest_x = 0;  
    
$dest_y = $size[1] - $corner_height; 
    
$rotated = imagerotate($corner_resized, 90, 0);
    
imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  

    
$dest_x = $size[0] - $corner_width;  
    
$dest_y = $size[1] - $corner_height;  
    
$rotated = imagerotate($corner_resized, 180, 0);
    
imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  

    
$dest_x = $size[0] - $corner_width;  
    
$dest_y = 0;  
    
$rotated = imagerotate($corner_resized, 270, 0);
    
imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  

imagealphablending($image, false);
imagesavealpha($image, true);
imagepng($image, "cov.png");

?>

<img src="cov.png"/>