带有 Verot class.upload.php 的 PhpMailer 附件已调整大小

PhpMailer Attachment with Verot class.upload.php resized

我正在使用 class.upload.php 调整表单中的图像大小,我想即时使用调整大小的图像通过 phpMailer 发送它,但我下面的代码不起作用 ;((

图片未发送!

在不发送邮件的情况下,调整大小的图像工作正常 ;))

感谢您的帮助...

$handle = new upload($_FILES['file']); 
if ($handle->uploaded) {
    //$handle->file_new_name_body   = 'image_resized';
    $handle->image_resize         = true;
    $handle->image_x              = 200;
    $handle->image_ratio_y        = true;
    $handle->image_no_enlarging   = true;
    $handle->jpeg_quality         = 50;

    $attach = base64_encode($handle->process());

    $mail->AddAttachment($attach, 'myimage.jpg');
}

addAttachment 从本地文件系统路径读取文件,使用 addStringAttachment 代替:

$mail->addStringAttachment($attach, 'myimage.jpg');

PHPMailer 文档页面:String Attachments