A horizontal dotted line cannot be drawn using the GD library of php.

Source: Internet
Author: User
Run PHPcode $ img = imagecreatetruecolor (600,600); $ white = imagecolorallocate ($ img, 255,255,255); imagedashedline ($ img, 20, 20, 500, cannot draw horizontal dotted lines with the GD library of php
Run the following code:
PHP code
  $img = imagecreatetruecolor(600, 600);$white = imagecolorallocate($img, 255, 255, 255);imagedashedline($img, 20, 20, 500, 20, $white);imagedashedline($img, 20, 20, 20, 500, $white);header("content-type:image/jpeg");imagejpeg($img);imagedestroy($img);

You will find that the vertical dotted line is OK, but the horizontal dotted line is not displayed. Who knows why?


------ Solution --------------------
PHP code
$ Img = imagecreatetruecolor (600,600); $ white = imagecolorallocate ($ img, 255,255,255); $ red = imagecolorallocate ($ img, 255, 0, 0 ); $ style = array ($ red, $ white, $ white ); imagesetstyle ($ img, $ style); imageline ($ img, 20, 20,500, 20, IMG_COLOR_STYLED); header ("content-type: image/jpeg "); imagejpeg ($ img); imagedestroy ($ img );
------ Solution --------------------
The bug reported by 'michi at marel dot at 'also exists in PHP version 5.1.1. This functions just works with vertical lines! 5.1.1. It should be replaced by a combination of imagesetstyle () and imageline ().
------ Solution --------------------
This functions just works with vertical lines! This function can only draw vertical lines!
------ Solution --------------------
Indeed, the GD database can only draw vertical dotted lines!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.