2017-03-23 13 views
0

を送信する私は、PHPのimagecreateで画像を作成し、私はphpmailerの持つ電子メールを通してそれを送りたいが、私は私が使用する必要がどの方法を理解していないとどのようにドキュメントから画像添付PHP

include 'Barcode39.php'; 
include 'PHPMailer.php'; 

$bar = new Barcode39('10127'); 

$bar->barcode_text_size = 10; 
$bar->barcode_bar_thick = 10; 
$bar->barcode_bar_thin = 5; 

$bar_img = $bar->draw(); 
$bar_size[0] = imagesx($bar_img); 
$bar_size[1] = imagesy($bar_img); 

$im = imagecreatefromjpeg('biglietto.jpg'); 

imagecopymerge($im, $bar_img, 10, 9, 0, 0, $bar_size[0], $bar_size[1], 100); 

$email = new PHPMailer(); 
$email->From = '[email protected]'; 
$email->Body = 'my email'; 
$email->AddAddress('[email protected]'); 

$email->addAttachment($im??); 

答えて

0

addAttachment(文字列$パス、文字列$名= ''、文字列$エンコード= 'BASE64'、文字列$ TYPE = ''、文字列$処分= '添付'):ブール

あなたのファイルに文字列パスを渡すだけで良いでしょう。

+0

添付するファイルは、$ imがimagecreateで作成されたものです。パスはどちらですか? – Quarillion

+0

イメージリンク($ im)を特定のファイルに保存するには、_imagejpeg_のような関数を使用する必要があると思います。 – Vini

関連する問題