php - function imagejpeg($image) doesn't display the image -
i trying make image generator php file , use code>
<?php header('content-type: image/jpeg'); $email = 'example@example.com'; $email_length = strlen($email); $font_size = 4; $image_height = imagefontheight($font_size); $image_width = imagefontheight($font_size) * $email_length; $image = imagecreate($image_width, $image_height); imagecolorallocate($image, 255, 255, 255); $font_color = imagecolorallocate($image, 0, 0, 0); imagestring($image, $font_size, 0, 0, $email, $font_color); imagejpeg($image); ?> and shows no image when load file in chrome. in mozilla shows error 'the image "..." cannot displayed because contains errors'. when put imagejpeg($image,"new.jpg"); instead of imagejpeg($image); makes img file correctly. know should fix problem?
i put code on local web server, took out header call, , got error saying function imagefontheight undefined.
i'm thinking may not have gd library installed, call image... function fails.
i can't tell more, unless tell operating system have, , how php being ran. (cli, in apache, etc.)
Comments
Post a Comment