如何在php中发送电子邮件时附加图像

I'm trying to attach an image to my email when I'm sending it through my project... So far I'm successfully sending emails from the below code.What are the changes I should use to add an attachment to this (adding an Image)... Please help me to change my code.I'm using cordelgniter

 public function sendMailToComplete($ID) {
        $this->load->model('get_db');
        $customers = $this->get_db->getBirthdays();
        $this->get_db->updateGreetingStatus();
        if (empty($customers)) {
            return;
        }
        foreach ($this->get_db->getEmailConfig() as $row) {
            $config = array(
                'protocol' => $row->protocol,
                'smtp_host' => $row->host,
                'smtp_user' => $row->user,
                'smtp_pass' => $row->pass,
                'smtp_port' => $row->port,
                'smtp_timeout' => $row->timeout,
                'mailtype' => $row->mailtype,
                'charset' => $row->charset
            );
            $this->load->library('email', $config);

            foreach ($customers as $customer) {
                $email = $customer['email'];

                $this->email->clear();
                $this->email->set_newline("
");
                $this->email->from($row->from, 'ABC');
                $this->email->to($email);
                $this->email->subject('Birthday Greetings');
                $this->email->message('Many Happy Returns of the day...');
                $this->email->send();
            }

            $this->email->clear();
        }
    }
 function getBirthdays()
        {
            $query = $this->db->query("select ci.* from customer_info ci where month(b_day) = month(curdate()) and day(b_day) = day(curdate());");
            return $query->result_array();
        }

You should look into PHPMailer library

An Example

$email = new PHPMailer();
$email->From      = 'donotreply@example.com';
$email->FromName  = 'donotreply@example.com';
$email->Subject   = $subject;
$email->Body      = $msg;
$email->AddAddress( $to );
$email->IsHTML(true);


if($_FILES['fUpload']['tmp_name'][0] !== '' 
&& preg_match("/image/", $_FILES['fUpload']['type'][0])){

 $file_to_attach = $_FILES['fUpload']['tmp_name'][0];
 $email->AddAttachment( $file_to_attach , $_FILES['fUpload']['name'][0]);           
}

$sent = $email->Send();

https://github.com/PHPMailer/PHPMailer