= $mtime)) { // Client's cache IS current, so we just respond '304 Not Modified'. header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT', true, 304); exit; } header("Content-Type: image/png"); header('Content-Length: '.filesize($file)); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT'); readfile($file); exit; } //Function that has all the magic function create_image($width, $height, $bg_color, $txt_color,$file ) { //Define the text to show $text = "$width X $height"; //Create the image resource $image = ImageCreate($width, $height); //We are making two colors one for BackGround and one for ForGround $bg_color = ImageColorAllocate($image, base_convert(substr($bg_color, 0, 2), 16, 10), base_convert(substr($bg_color, 2, 2), 16, 10), base_convert(substr($bg_color, 4, 2), 16, 10)); $txt_color = ImageColorAllocate($image,base_convert(substr($txt_color, 0, 2), 16, 10), base_convert(substr($txt_color, 2, 2), 16, 10), base_convert(substr($txt_color, 4, 2), 16, 10)); //Fill the background color ImageFill($image, 0, 0, $bg_color); //Calculating (Actually astimationg :) ) font size $fontsize = 6; $font = $_SERVER['DOCUMENT_ROOT'].'/szarosc/newscycle-regular.ttf'; // die ($font); //Write the text .. with some alignment astimations imagettftext($image,$fontsize, 0, ($width-20) - ($fontsize * 2.75), ($height - ($fontsize* 0.2)), $txt_color, $font, $text); //Output the newly created image in png format imagepng($image,$file); //Free up resources ImageDestroy($image); } ?>