<?php
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
this code is displaying error-
The image"http://localhost/untitled.php" cannot be displayed because it contains errors.
I am actually trying to make an image editor using php and here I am just simply trying to create an image using php and upload it in on the server. my code is showing the error as stated above.
What is actually the problem I don't understand.
<?php
$my_img = imagecreate( 200, 80 );
$background = imagecolorallocate( $my_img, 0, 0, 255 );
$text_colour = imagecolorallocate( $my_img, 233, 14, 91 );
$line_colour = imagecolorallocate( $my_img, 233, 14, 91 );
imagestring( $my_img, 4, 30, 25, "A Simple Text String", $text_colour );
imagesetthickness ( $my_img, 5 );
imageline( $my_img, 30, 45, 165, 45, $line_colour );
header( "Content-type: image/jpg" );
imagepng( $my_img );
//imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>