<?php

namespace Mtc\Plugins\NHS\Classes;

use Mtc\Modules\Members\Models\Member;

$path = '../../../';
require_once $path . 'core/includes/header.inc.php';

$member = Member::query()
    ->with('nhs_member')
    ->find(filter_input(INPUT_GET, 'id'));

$consent_file_path = $member->nhs_member->getConsent();


$fp = fopen($consent_file_path, 'rb');

// send the right headers
header("Content-Type: " . mime_content_type($consent_file_path));
header("Content-Length: " . filesize($consent_file_path));

// dump the picture and stop the script
fpassthru($fp);