imagepng的奇怪有关问题
imagepng的奇怪问题
代码如下,奇怪的是把imagepng($im)改为imagepng($im,"kk.png")可以得到图片但是直接输出至浏览器就是显示不出来,一直是红叉,这段代码在另一台机器上能正常运行。是我的php配置问题吗?
header("Content-type: image/png");
srand((double)microtime()*1000000);
$login_check_number=strval(rand("11111","99999"));
//$session->setMember("loginCheckNumber", $login_check_number);
$im = imagecreate(50,20) or die ("Cannot Initialize new GD image stream");
$black = ImageColorAllocate($im, 9,142,204);
$foreColor = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageline($im, 1, 1, 350, 25, $black);
imagearc($im, 200, 15, 20, 20, 35, 190, $white);
imagestring($im, 5, 7, 3, $login_check_number, $white);
for($i=0 ; $i {
imagesetpixel($im, rand()%50 , rand()%50 , $foreColor);
}
imagepng($im);
imagedestroy($im);
?>
------解决方案--------------------

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 Convert PNG to JPG on Windows 11 On Windows 10 and 11, you can use Microsoft's built-in Paint app to quickly convert image files. To convert a PNG image to JPG on Windows 11, use the following steps: Open File Explorer and navigate to the PNG image you want to convert. Right-click the image and select Open With > Draw from the menu. Your photo or image opens in the Paint app. Note the file size at the bottom of the screen. To convert a file from PNG to JPG, click File and select Save As > JPEG Image from the menu. When the file resource

Suppose you need to rename the extension of a file from one extension to another, say jpg to png. It's easy, of course! But what if you have multiple files whose extensions need to be changed? Or worse, what if these multiple files are also located in multiple folders and subfolders, within a single folder? Well, for a normal person, this can be a nightmare. But for a geek, absolutely not. The question now is, are you a geek? Well, with the help of Geek Page, you definitely are! In this article, we explain how to easily rename the extension of all files within a folder, including subfolders of your choice, from one extension to another through a batch script method. Notice:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

png is a bitmap format that uses a lossless compression algorithm. The PNG format has three forms: 8-bit, 24-bit, and 32-bit. The 8-bit PNG supports two different transparent forms. The 24-bit PNG does not support transparency. The 32-bit PNG adds an 8-bit transparent channel to the 24-bit. Therefore, Can display 256 levels of transparency.

How to make a picture into a png: 1. Open the PS software; 2. Find the picture that needs to be processed and import it into the software; 3. Adjust the background color of the picture to white; 4. Select the "Magic Eraser" tool and click The background area on the picture that needs to be made transparent; 5. Click "File" - "Save As" in the menu bar, select "png" in the save format in the pop-up window, and export the picture in png format.

PNG is a common image file format. It is a lossless compression format, which means that it does not lose image quality. PNG stands for Portable Network Graphics. The PNG file format was originally created by a group of developers in 1996 and was intended to replace some limited and inefficient file formats such as GIF. The PNG file format is based on a lossless compression algorithm and utilizes indexes, palettes, and grayscale images to store image data. Compared to other image formats, PN

PNG is a common image file format, whose full name is "Portable Network Graphics". It is a lossless compression format designed to replace the JPEG and GIF formats commonly used in the past. The PNG format was created in 1995 by graphic designer Thomas Boutell and grew in popularity over the following years. The PNG format is characterized by supporting high-quality image compression while retaining image details and color information. Comparable to JPEG format

Compared with jpeg and png, the png format is clearer; because the png format is a lossless format, while the jpeg format is lossy compression, which will reduce the quality of the original image data; therefore, if you use files produced by drawing software, save When you choose to save the png format, it will be clearer than the jpeg format.
