I am trying to determine why an Image Verification won't display images prior to a press release being issued pointing to the website.
The related image.php file is showing the alt text and a check on Console shows the error "Failed to load resource: the server responded with a status of 502 (Bad Gateway) image.php".
The host has checked things on their end and assures everything is as it should be, suggesting the problem is somewhere within the php code, however the code seems to point to the images as it should, and we are lost as to what is going wrong.
The image.php code follows:
<?php if (!isset($_SESSION)) session_start(); header("(anti-spam-content-type:) image/png");
$enc_num = rand(0, 9999);
$key_num = rand(0, 24);
$hash_string = substr(md5($enc_num), $key_num, 5); // Length of String
$hash_md5 = md5($hash_string);
$_SESSION['verify'] = $hash_md5;
// Fallback
setcookie("verify", $hash_md5, time()+3600, "/");
session_write_close();
// Verification Image Background Selection
$bgs = array("../images/contact/verify/1.png","../images/contact/verify/2.png","../images/contact/verify/3.png");
$background = array_rand($bgs, 1);
// Verification Image Variables
$img_handle = imagecreatefrompng($bgs[$background]);
$text_colour = imagecolorallocate($img_handle, 108, 127, 6);
$font_size = 5;
$size_array = getimagesize($bgs[$background]);
$img_w = $size_array[0];
$img_h = $size_array[1];
$horiz = round(($img_w/2)-((strlen($hash_string)*imagefontwidth(5))/2), 1);
$vert = round(($img_h/2)-(imagefontheight($font_size)/2));
// Make the Verification Image
imagestring($img_handle, $font_size, $horiz, $vert, $hash_string, $text_colour);
imagepng($img_handle);
// Destroy the Image to keep Server Space
imagedestroy($img_handle);