Captcha PHP image not showing in chrome

I am using PHP to create a captcha image. At the time of loading, a swing is displayed. When the download is complete, it does not display the captcha image in Chrome. In other browsers it works 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); ?> 
0
source share
2 answers

having the same problem .. One of the possible reasons is an anti-banner / antivirus. I use Karpersky .. when I turned off the kaspersky captcha, showing ok, a little strange from Chrome .. I think they should look for this problem

+2
source

All your code is correct, just turn it on

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

above your code ...

+1
source

Source: https://habr.com/ru/post/1442450/


All Articles