php - imagecolorallocate returns 0 for background color -


i'm trying create bar-code , i'm having issue it.

this code

$number = $this->uri->segment(3); $width = 200; $height = 80;  $img = imagecreate($width, $height);  $white = imagecolorallocate($img, 255, 255, 255); // return 0 $black = imagecolorallocate($img, 0, 0, 0); // return 1   imagettftext($img, 36, 0, 10, 50, $black, $barcode_font, $number);  imagettftext($img, 14, 0, 40, 70, $black, $plain_font, $number); header('content-type: image/jpeg'); imagejpeg($img); imagedestroy($img); 

but isn't creating bar-code, said : image cannot displayed because contains errors. please give me idea solve issue, still cannot find solutions


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -