SlightPHP\PHPMailer::EncodeFile PHP Method

EncodeFile() public method

Encodes attachment in requested format. Returns an empty string on failure.
public EncodeFile ( $path, $encoding = 'base64' ) : string
return string
    public function EncodeFile($path, $encoding = 'base64')
    {
        if (!@($fd = fopen($path, 'rb'))) {
            $this->SetError($this->Lang('file_open') . $path);
            return '';
        }
        if (function_exists('get_magic_quotes')) {
            function get_magic_quotes()
            {
                return false;
            }
        }
        if (PHP_VERSION < 6) {
            $magic_quotes = get_magic_quotes_runtime();
            set_magic_quotes_runtime(0);
        }
        $file_buffer = file_get_contents($path);
        $file_buffer = $this->EncodeString($file_buffer, $encoding);
        fclose($fd);
        if (PHP_VERSION < 6) {
            set_magic_quotes_runtime($magic_quotes);
        }
        return $file_buffer;
    }