0

I use PHP for creating a captcha image. It is showing the captcha at the time of loading. After completing the loading, it doesn't show the captcha image in Chrome. In other browsers, it is working fine. Why?

<?php
// Create an image from button.png
$image = imagecreatefrompng('button.png');

// Set the font colour
$colour = imagecolorallocate($image, 255, 120, 4);

// Set the font
$font = '../fonts/Anorexia.ttf';

// Set a random integer for the rotation between -15 and 15 degrees
$rotate = rand(-15, 15);

// Create an image using our original image and adding the detail
imagettftext($image, 18, $rotate, 18, 30, $colour, $font, $str);

// Output the image as a png
imagepng($image);

?>
Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
Roni
  • 70
  • 1
  • 8

2 Answers2

2

having same problem.. One possible reason is anti-banner/ antivirus.. i am using Karpersky.. when i turned off kaspersky captcha showing ok, little bit strange from Chrome.. I think they should look for this problem

Saifuddin Sarker
  • 853
  • 3
  • 8
  • 26
  • Thanks.. I have turned off the kaspersky like u said. Now it's working. What is the reason for it? – Roni Oct 30 '12 at 06:34
  • its little bit strange from chrome. as far as i know captche is loading from php file having header so its consider as a external banner thats why it has been blocked in chrome. dont forget to make my answer correct :) – Saifuddin Sarker Oct 30 '12 at 06:35
  • Done .. :) Okay is there any other way to display the captcha instead of turn off the kaspersky? – Roni Oct 30 '12 at 06:42
  • probaly not(not sure), if you look some captcha plugin example site on chrome then u will see the same problem. you can give a try google captcha plugin. that may work in chrome. – Saifuddin Sarker Oct 30 '12 at 06:51
1

Your whole code is correct just include

header('Content-Type: image/png');

above your code...

Jigar Kotak
  • 176
  • 7