Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

ROnaldinhoR9

captcha php não cria imagem (fica uma imagem rompida no local )

Recommended Posts

Olá boa tarde a todos. Tenho um site, que roda em appserv, q tem php5 e apache 2.2. Tem uma pagina de registro de conta, que gera uma captcha, para impedir spam. Mas acontece que essa imagem, não aparece, mostra apenas um imagem rompida no meio, como se não achasse a imagem, ou não conseguisse gerar ela.
Esse é o código, q faz gerar a imagem ( quando a imagem não aparece, e clico com o botão direito nela, ela mostra esse verify.php)

d1hsuod8cmsk7vpdm.jpg

<?php
session_start();
$alphanum = "ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789";
$rand = substr(str_shuffle($alphanum), 0, 5);
$bgNum = rand(1, 4);
$image = imagecreatefromjpeg("background$bgNum.jpg");
$textColor = imagecolorallocate ($image, 0, 0, 0);
imagestring ($image, 5, 5, 8, $rand, $textColor);
$_SESSION['image_random_value'] = md5($rand);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
 
?>
Na imagem rompida, pelo firefox, clico pra ver a imagem, e ele me gera isso:

Warning: session_start() [function.session-start]: open(C:/Users/RYL/AppData/Local/Temp\sess_3b93595b8b503527da2985abce150444, O_RDWR) failed: No such file or directory (2) in C:\AppServ\www\Buas\verify.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 10

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 11

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Buas\verify.php:2) in C:\AppServ\www\Buas\verify.php on line 15
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀ<"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ?ô[Ë}^{™ZÒäO8 ’tÁî;ÿ‘N¾‹S]NÝ yL¨ªAN1»v:qÛ½s^3Õ.¼17ÛE«©Ce1¹rDዸ9q´rxñÍ`ÝøŸVÒ<¬ë°ùØΑ® Ê?›tªr]‘•c´O€q±ëº‘Ku§—õ±ß^A¨Þj>}•À¸³‘¸1NN0sš~£­&´âÝ%16>á³hôú÷®2¤~.ÒôM&ÿK¾‡TŽå'x.VfO.=èAVÂäŒ|Àô8â®ørÿTÔ5/øvêxXµ¿ÙV‡q‘Y°Ù'°1ž½ø›2”â“NÚlt×°ê7:¤—}êµ¹Áf‚±9ÈôÎzzÒÞ-Õü…ô»Ñ4H¢)\‚Œ3Éý9ö®f?iZR궗š–É–Qi#˜$h\•¦ c_¼ å†ÜóŠK_é–êÏs4k rÎ-ä0G6@Úó…(¤x€2sŠ5ì;Á+©-4:«¨/ïOmwd@·;eùQ±É8úVŽ˜è,Â¥Ü÷X8iwíÉïŠæ´8ÚÞy±§öºµ¤’6<ÐFàpyèO'šÙÒ¬'·´)p¡d.NÒäcÓ¯î÷±QåµÕ‘ÊøßÁ÷þ*º²h$¶¹¶ƒQŽâq4£o–¹˜Ç^HÁãÞ±µ¿j÷¾¼Ñ­5­:}5"‰-dº¸bö„:³C¸)-å?xp¼‘é ¡L¨,{.×ð3ß׎*½§†îaÓï£yãg˜)VÉÀ9ôÇ…4É÷$®åå·FsZׇåñ'‰|7©iIk¤Ç4sÇ)*ãzí9ôöªÚ†õ;ß뺺K§Kk|ЪùWò'”0(£rpN:õ®³NðÌö²Í<³£)•FIäŽ{S¬<3=¬÷›žÒDȤg¿¯?:ZõE^“q–«U§}åº÷ÃÏk:tÖ¯}§,ò3.¢oç)*ù…€0ÿ«ˆc Àc®á¯hú¨ÕÊú3yþ¹xec}~µ§¥iÚYyM"±ÜI!$¯©U*®N[õìÿÙ
Warning: Unknown: open(C:/Users/RYL/AppData/Local/Temp\sess_3b93595b8b503527da2985abce150444, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:/Users/RYL/AppData/Local/Temp) in Unknown on line 0ºn§w¥í¨5ãzûg.ëâ1!ò)y%_÷cû£ú¬|?u½übés*:ôïÿzž>

Isso acontece no servidor, que roda windows server 2003. No server teste em casa, abre a imagem normalmente. Acredito que seja algo particular no host.
Alguém poderia me ajudar, dar uma luz? Se precisar de mais informações, só pedir.
Talvez eteja relacionado ao modulo gd? Se sim, como checo e habilito ele?

Compartilhar este post


Link para o post
Compartilhar em outros sites

A imagem não aparece pois há mensagens de erro antes do código dela

 

Não pode haver saídas ao navegador antes de session_start().

Veja http://rberaldo.com.br/as-mensagens-de-erros-mais-comuns-do-php/#header

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.