Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/11/2015, 20:26
0fran
 
Fecha de Ingreso: mayo-2015
Ubicación: Localhost
Mensajes: 13
Antigüedad: 9 años
Puntos: 1
No se termina de ejecutar todo el código

Hola, ¿Como seria la manera correcta para que se termine de ejecutar todo el código y se redireccione?
Código PHP:
Ver original
  1. <?php
  2.  
  3. $id    = time();
  4. // Definir texto que se imprimirá en Imagen
  5. $text  = $_POST['text'];
  6. $firma = "Ejemplo";
  7.  
  8. // Establecer el tipo de contenido
  9. header('Content-type: image/jpeg');
  10.  
  11. //Crear imagen desde archivo existente
  12. $jpg_image = imagecreatefromjpeg('../images/sunset.jpg');
  13.  
  14. //Asignar un color para el texto
  15. $white = imagecolorallocate($jpg_image, 255, 255, 255);
  16.  
  17.  
  18. $font_path = '../fonts/1.ttf';
  19.  
  20.  
  21.  
  22. imagettftext($jpg_image, 25, 0, 400, 140, $white, $font_path, $text);
  23. imagettftext($jpg_image, 10, 0, 750, 300, $white, $font_path, $firma);
  24.  
  25.  
  26. imagejpeg($jpg_image, '../album/images/' . $id . '.jpeg');
  27. imagejpeg($jpg_image, NULL, 100);
  28.  
  29. imagedestroy($jpg_image);
  30.  
  31. $file = "$id.html"; //Donde se guardara
  32. $data = "<center><IMG SRC='../album/images/$id.jpeg'></center>"; //Lo que se vera
  33. $file = fopen($file, "w"); //Abriendo archivo
  34. fwrite($file, $data); //Enviar datos al archivo
  35. fclose($file); //Cerar archivo
  36.  
  37. $pagina = '/' . $id . '.html';
  38.  
  39. if (file_exists($pagina)) {
  40.     header('Location: /' . $id . '.html');
  41. } else {
  42.     echo "El fichero  no existe";
  43. }
  44.  
  45. ?>