PHP Image display error -
<?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 displaying error-
the image"http://localhost/untitled.php" cannot displayed because contains errors.
i trying make image editor using php , here trying create image using php , upload in on server. code showing error stated above.
what problem 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 ); ?>
Comments
Post a Comment