Ver Mensaje Individual
  #5 (permalink)  
Antiguo 09/12/2013, 05:38
Avatar de marlanga
marlanga
 
Fecha de Ingreso: enero-2011
Ubicación: Murcia
Mensajes: 1.024
Antigüedad: 13 años, 3 meses
Puntos: 206
Respuesta: Generar imagen con texto transparente

Código PHP:
Ver original
  1. <?php
  2. header( "Content-type: image/png" );
  3. $imageName="cat.jpg";
  4.  
  5. $img = imagecreatefromjpeg($imageName);
  6.  
  7. $mask=imagecreate(70, 35);
  8. $negro = imagecolorallocate($mask, 0, 0, 0);
  9. $rojo = imagecolorallocate($mask, 255, 0, 0);
  10. imagecolortransparent($mask, $rojo);
  11. imagestring($mask, 5, 10, 10, "HOLA", $rojo);
  12.  
  13. imagecopy($img, $mask, 100, 100, 0, 0, 70, 35);
  14.  
  15. imagepng($img);