private function outputImageForDownload($filepath, $filename, $mimeType = "") { $contents = file_get_contents($filepath); $filesize = strlen($contents); if ($mimeType == "") { $info = UniteFunctionsBanner::getPathInfo($filepath); $ext = $info["extension"]; $mimeType = "image/{$ext}"; } header("Content-Type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Content-Length: {$filesize}"); echo $contents; exit; }