i have created a captcha image with php code. the following is my code to create random captcha image. these codes have saved in a file that it's name is captcha.php
<?php
session_start();
header("Content/text:image/png");
$_SESSION["captcha"]=rand(10000,99999);
$captchaText=$_SESSION["captcha"];
//----- captcha properties variables -------
$captchaTextSize=30;
$captchaTextAngle=rand(5,15);
$X_ofCaptchaText=40;
$Y_ofCaptchaText=50;
$captchaFont="../../fonts/captchaFont.TTF";
$captchaImageWidth=190;
$captchaImageHeight=65;
//-------- noise properties variables --------
$captchaNoise="===================";
$captchaNoiseSize=15;
$captchaNoiseAngle=0;
$captchaNoiseColor=
$X_ofCaptchaNoise=0;
$Y_ofCaptchaNoise=rand(25,55);
//--------------------------------------------
$captchaImage=imagecreate($captchaImageWidth,$captchaImageHeight);
imagecolorallocate($captchaImage,255,255,255);//set the background color of an image
$captchaTextColor=imagecolorallocate($captchaImage,0,128,255); //set the font color
imagefttext($captchaImage,$captchaTextSize,$captchaTextAngle,
$X_ofCaptchaText,$Y_ofCaptchaText,$captchaTextColor,
$captchaFont,$captchaText);
imagefttext($captchaImage,$captchaNoiseSize,$captchaNoiseAngle,
$X_ofCaptchaNoise,$Y_ofCaptchaNoise,$captchaTextColor,$captchaFont,
$captchaNoise); //set the noise on the image
imagepng($captchaImage);
and in my page i fetch captcha.php in an img tag as src:
<img src="model/captcha/captcha.php" id="captcha"/>
when the page load by http, there is no problem and captcha image loads successfuly:
but when i open the pages that contains the above img tag with https protocol, captcha doesnt load:
in addition when use https in page url this error appear in console: net::ERR_HTTP2_PROTOCOL_ERROR
i have tried it in google chrome and fire fox.both of them have this problem