Ver Mensaje Individual
  #5 (permalink)  
Antiguo 14/12/2009, 15:05
Avatar de thosecars82
thosecars82
 
Fecha de Ingreso: abril-2008
Mensajes: 32
Antigüedad: 16 años, 1 mes
Puntos: 0
Respuesta: write text to transparent image

Cita:
Iniciado por jackson666 Ver Mensaje
Para que preguntas en ingles, sabiendo que la mayoria de este foro son de habla hispana?
Discúlpame que no me he dado cuenta.
Mira ya que no veo donde está el problema para intentar simplificar el código lo he dejado así:

Código:
<?php
header("Content-type: image/png"); //Picture Format
$bg = imagecreatetruecolor(350, 75);

//This will make it transparent
imagesavealpha($bg, true);

$trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127);
imagefill($bg, 0, 0, $trans_colour);


//Create image
imagepng($bg);

//destroy image
ImageDestroy($bg);
?>
De esta manera no se debería mostrar nada pues el rectángulo negro en un principio se habría convertido en transparente con
las líneas
Código:
//This will make it transparent
imagesavealpha($bg, true);

$trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127);
imagefill($bg, 0, 0, $trans_colour);
sin embargo sigue ocurriendo que cuando lo ejecuto en remoto (www.arreglaordenador.com/numberimage4.php) se ve el rectángulo en negro como si no funcionara la transparencia y cuando lo ejecuto en local, el rectángulo no se ve tal y como era de esperar pues he puesto las dos líneas de código para hacer el rectángulo transparente.

¿a alguien se le ocurre alguna idea sobre por qué no funciona la transparencia en el servidor remoto pero sí en el local?
El phpinfo() del servidor remoto me muestra los siguientes ajustes para GD library:

Configure Command
'./configure' '--prefix=/usr/local/php5' '--with-mysql=/usr' '--with-gd' '--with-gzip' '--with-zlib' '--with-kerberos' '--enable-ftp' '--enable-gd-native-ttf' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-xpm-dir=/usr' '--with-png-dir=/usr' '--with-imagick' '--enable-bcmath' '--with-xml' '--with-dom' '--with-gettext' '--enable-mbstring' '--with-curl' '--with-imap' '--enable-calendar' '--enable-mhash' '--enable-openssl' '--with-openssl=/usr' '--enable-exif' '--with-mhash=/usr' '--enable-mcrypt' '--with-mcrypt=/usr' '--with-imap-ssl' '--enable-xslt' '--with-dom-xslt=/usr' '--with-xslt-sablot=/usr' '--with-config-file-path=/home/sys/php5' '--with-pgsql=/usr' '--with-pdo-mysql' '--with-pdo-pgqsl' '--with-mysqli' '--with-pear' '--with-iconv' '--with-xsl=/usr' '--enable-fastcgi'

Código:
GD Support  enabled  
GD Version  bundled (2.0.34 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
FreeType Version  2.1.7  
GIF Read Support  enabled  
GIF Create Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  
XPM Support  enabled  
XBM Support  enabled
Agradezco cualquier idea para que funcione la transparencia en el servidor remoto.
Muchas gracias.

Última edición por thosecars82; 05/04/2011 a las 15:24