用php的GD库画不出水平的虚线解决方法
用php的GD库画不出水平的虚线
运行一下以下代码
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$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);
你会发现垂直的虚线没问题,但水平虚线就不显示。有谁知道为什么?
------解决方案--------------------
- PHP code
$img = imagecreatetruecolor(600, 600);$white = imagecolorallocate($img, 255, 255, 255);$red = imagecolorallocate($img, 255, 0, 0);$style = array($red, $red, $red, $red, $red, $white, $white, $white, $white, $white);imagesetstyle($img, $style);imageline($img, 20, 20, 500, 20, IMG_COLOR_STYLED);header("content-type:image/jpeg");imagejpeg($img);imagedestroy($img);<br><font color="#e78608">------解决方案--------------------</font><br>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版本发现的BUG,反对使用本函数。应该用 imagesetstyle() 和 imageline() 的组合替代之<br><font color="#e78608">------解决方案--------------------</font><br>This functions just works with vertical lines!该函数只能画垂直线!<br><font color="#e78608">------解决方案--------------------</font><br>确实,GD库只能画竖直的虚线!<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to create complex card styles using CSS? In daily web design, card style is a common and important layout method. Today we want to explain...

MySQL download file is corrupt, what should I do? Alas, if you download MySQL, you can encounter file corruption. It’s really not easy these days! This article will talk about how to solve this problem so that everyone can avoid detours. After reading it, you can not only repair the damaged MySQL installation package, but also have a deeper understanding of the download and installation process to avoid getting stuck in the future. Let’s first talk about why downloading files is damaged. There are many reasons for this. Network problems are the culprit. Interruption in the download process and instability in the network may lead to file corruption. There is also the problem with the download source itself. The server file itself is broken, and of course it is also broken when you download it. In addition, excessive "passionate" scanning of some antivirus software may also cause file corruption. Diagnostic problem: Determine if the file is really corrupt

How to select and set the element style for the first specific class? In web development, it is often necessary to style elements of specific class names, especially when...

Remote Senior Backend Engineer Job Vacant Company: Circle Location: Remote Office Job Type: Full-time Salary: $130,000-$140,000 Job Description Participate in the research and development of Circle mobile applications and public API-related features covering the entire software development lifecycle. Main responsibilities independently complete development work based on RubyonRails and collaborate with the React/Redux/Relay front-end team. Build core functionality and improvements for web applications and work closely with designers and leadership throughout the functional design process. Promote positive development processes and prioritize iteration speed. Requires more than 6 years of complex web application backend

Flexible use of CSSbox-shadow attributes: realize the clever combination of single-sided inner shadow and three-sided outer shadow. In web design, box-shadow...

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

To improve the performance of PostgreSQL database in Debian systems, it is necessary to comprehensively consider hardware, configuration, indexing, query and other aspects. The following strategies can effectively optimize database performance: 1. Hardware resource optimization memory expansion: Adequate memory is crucial to cache data and indexes. High-speed storage: Using SSD SSD drives can significantly improve I/O performance. Multi-core processor: Make full use of multi-core processors to implement parallel query processing. 2. Database parameter tuning shared_buffers: According to the system memory size setting, it is recommended to set it to 25%-40% of system memory. work_mem: Controls the memory of sorting and hashing operations, usually set to 64MB to 256M

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node
