用PHP代码在网页上生成图片
代码很简单,这里就不多废话了,
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/6/29
* Time: 21:25
*/
header('Content-type:image/png');//设置mime type
$img = imagecreate(400,300);//设置图片像素
imagecolorallocate($img,255,255,255);//给图片上色
imageellipse($img,200,200,50,50,imagecolorallocate($img,255,0,0));//在图片上绘制图形,中心点200,200;宽高50,50
imagepng($img);//设置图片格式为PNG
效果如下:
以上所述就是本文的全部内容了,希望大家能够喜欢。
时间: 2015-06-28
php代码如下: 复制代码 代码如下: <?php header("Content-type:text/html ; charset=utf-8"); if (!empty($_POST['submit'])){ $url = $_POST['url']; //为了获取相对路径的图片所做的操作 $url_fields = parse_url($url); $main_url = $url_fields['host']; $base_url = substr($url,0,strr
复制代码 代码如下: <?php header("Content-type:image/jpeg"); function read_url($str) { $file=fopen($str,"r"); while(!feof($file)) { $result