I created an image with php imagecreate and I want to send it through e-mail with PHPMailer, but I don't understand which method I have to use and how
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 = 'myemail@email.com';
$email->Body = 'my email';
$email->AddAddress( 'myemail@email.com' );
$email->addAttachment($im??);
From documentation:
addAttachment(string $path, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'attachment') : boolean
Just provide string path to your file and you will be good.