请教,如何使用gd操作直接生成图片文件
请问,怎么使用gd操作直接生成图片文件?
比如这样的代码(file1.php):
<br /><?php<br />$img = imagecreatetruecolor(300,200);<br />$color = imageColorAllocate($img, 200,0,0);<br />//输出英文字:<br />ImageString($img, 5, 100, 50, "abc123@#¥a", $color);<br />//header("content-type: image/png"); <br />imagePng( $img );<br />imagedestroy($img);<br />?><br />
我只能在另一个文件中,通过这样的html代码
我想实现的效果是,在一个php文件(网页)中,刷新一下,就在该网页的本身目录(文件夹)下,生成一张图片文件。网页界面上能不能看到无所谓。图片文件名可以采用某种不重复的随机字符来表示,图片上的文字内容当然也可以随机。这都不是重点。重点就是,刷新一下网页,就得到一个图片文件。
------解决思路----------------------
imagePng( $img, "图片文件名" );

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

AI Hentai Generator
Generate AI Hentai for free.

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

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
