小编Ada*_*ers的帖子

通过电子邮件发送动态创建的图像

我需要动态创建一个图像,然后通过电子邮件发送给该人.这是图像创建脚本:

//Get the blank coupon
$rImg = ImageCreateFromJPEG('coupon.jpg');

$color = imagecolorallocate($rImg, 0, 0, 0);

imagestring($rImg,5,135,140,'$first_name', 'black');
imagestring($rImg,5,135,160,'$last_name', 'black');
imagestring($rImg,5,135,180,'$email_address', 'black');
Run Code Online (Sandbox Code Playgroud)

从那里我想拍摄该图像并通过电子邮件发送给该人.我可以将其包含在电子邮件的附件中,还是实际上必须将其写入服务器?

我试过这样做:

function email_coupon($first_name, $last_name, $email_address){
//Get the blank coupon
$rImg = ImageCreateFromJPEG('coupon.jpg');

$color = imagecolorallocate($rImg, 0, 0, 0);

imagestring($rImg,5,135,140,'$first_name', 'black');
imagestring($rImg,5,135,160,'$last_name', 'black');
imagestring($rImg,5,135,180,'$email_address', 'black');

//define the receiver of the email
$to = '$email_address';
//define the subject of the email
$subject = 'Your coupon';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate …
Run Code Online (Sandbox Code Playgroud)

php email gd image-processing

4
推荐指数
1
解决办法
1447
查看次数

计算PHP脚本的最佳方法

查看PHP脚本运行所需时间的最佳方法是什么?

我在想这样的事情:

$start_time = time(); //this at the beginning
$end_time = time(); //this at the end
echo = $end_time-$start_time;
Run Code Online (Sandbox Code Playgroud)

但是我怎样才能把它变成对我来说可读并对我有意义的东西呢?

php

2
推荐指数
1
解决办法
233
查看次数

标签 统计

php ×2

email ×1

gd ×1

image-processing ×1