NomikOS

msg:3682091 | 3:36 am on Jun 24, 2008 (gmt 0) |
$im = imagecreatefromPNG ('file.png'); imagePNG($im)
[edited by: NomikOS at 3:40 am (utc) on June 24, 2008]
|
vladady

msg:3682097 | 3:47 am on Jun 24, 2008 (gmt 0) |
I know. It is already created into $im, it's a CAPTCHA image to be more exact. I put in the post only the code from where the headers sending starts. That's because i ouputed the image into a file and looked at it with a photo viewer. The script creates the correct image! I tested the png file created in both browsers and it displays correct too. The problem is to display it with headers....
|
NomikOS

msg:3682139 | 6:20 am on Jun 24, 2008 (gmt 0) |
I did a problematic captcha script sometime but now i'dont remember it. Is something like this right?
<img src="captcha.php"/> <?php # captcha.php $im = imagecreatefrompng('file.png'); # (BTW: don't forget do it not cacheable for it can change between page loads) header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?>
Is the path to script correct? src="{_path_}captcha.php" Is there subdomains involucred? [edited by: NomikOS at 6:23 am (utc) on June 24, 2008]
|
vladady

msg:3682296 | 11:57 am on Jun 24, 2008 (gmt 0) |
Yes it's like that: <img src="captcha.php?code=CODE"/> <?php # captcha.php $im = imagecreatefrompng('file.png'); . . . header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> The script's path is : './captcha.php'. But either if call directly in the browser it doesn't work. Only if i put the image to a png file, it shows well. What can be the problem? I tried with the headers: header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); and the situation is the same.
|
wtkad

msg:3682314 | 12:23 pm on Jun 24, 2008 (gmt 0) |
Have you tried using ImagePNG($im) without setting the header? It will let you see the "raw" PNG output and maybe see if there are any hidden errors.
|
vladady

msg:3682370 | 1:48 pm on Jun 24, 2008 (gmt 0) |
It was a very stupid thing: "<?php" , an extra tab before one of the php files. It was very hard to find because i have a lot of php files. I noticed it only when commenting ImagePNG and selecting what was in the view source. If i wouldn't have selected the text, i would have thinked that the it is ok, and no extra characters. The extra character wasn't appearing in the file when i was exporting it. Thank you guys for the replies.
|
NomikOS

msg:3682704 | 8:06 pm on Jun 24, 2008 (gmt 0) |
Happy to see that you resolve the problem. That's the fun ... [edited by: NomikOS at 8:12 pm (utc) on June 24, 2008]
|
|