Re: Problems creating images

From: Date: Wed, 05 Apr 2006 20:05:37 +0000
Subject: Re: Problems creating images
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-233300@lists.php.net to get a copy of this message
I added image confirmation to a guestbook and even though it works greate for most people, some people have problem and I can't seem to figure out why this happens. Note that I'm not talking about the same guestbook on one server but the guestbook is on people's own hosting server. The php code to create the image can't be simpler: *confirm_image.php:* $datekey = date("F j"); $rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $cfg_sitekey . $random_num . $datekey)); $code = substr($rcode, 2, 6); $image = ImageCreateFromJPEG("images/code_bg.jpg"); $text_color = ImageColorAllocate($image, 80, 80, 80); Header("Content-type: image/jpeg"); ImageString ($image, 5, 12, 2, $code, $text_color); ImageJPEG($image, '', 75); ImageDestroy($image); Most people get a nice image but some people get only, what appears to be, garbage: JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 75 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222 ...snip... For the complete output have a look here: http://www.samuel-area.de/phpbook/confirm_image.php Do you know what is going wrong here?
Not entirely, but when I go to that URL and check the headers (Live HTTP header extension in firefox) I get this: HTTP/1.x 200 OK Date: Wed, 05 Apr 2006 20:02:02 GMT Server: Apache/2.0.53 (Fedora) X-Powered-By: PHP/4.3.11 Content-Length: 1501 Connection: close Content-Type: text/html; charset=iso-8859-1 Notice that last one... I see you set it up above, but it isn't sticking.... -philip

« previous php.general (#233300) next »