I want to make an image "onfly" with some text. Is it possible with php? I am trying with this one but no output is coming can anyone watch my code please?
function createCaptcha($string){
$image = PATH_DIR . "blueprint/images/bg6.png";
$text_vertical_position = 97;
$font_size = 15;
$color = '32a53d';
Header ("Content-type: image/png");
$color = convert_to_rgb($color);
$info = GetImageSize($image);
$width = $info[0];
$height = $info[1];
if (preg_match("/.gif/", $image)) {
$image = imageCreateFromGif($image);
} elseif (preg_match("/.png/", $image)) {
$image = imageCreateFromPng($image);
} elseif (preg_match("/.jpg/", $image)) {
$image = imageCreateFromJpeg($image);
} elseif (preg_match("/.jpeg/", $image)) {
$image = imageCreateFromJpeg($image);
}
$imgcolor = ImageColorAllocate ($image, $color[0], $color[1], $color[2] );
imagettftext($image, $font_size, 0, $start_length, $text_vertical_position,
$imgcolor, $font , $text);
ImagePNG ($image);
ImageDestroy ($image);
}
I am using codeigniter to make it.
Thank You