simpletype; if ($simpletype == "image") { // Get file thumbnail switch ($size) { case "small": $thumbfile = $file->thumbnail; break; case "medium": $thumbfile = $file->smallthumb; break; case "large": default: $thumbfile = $file->largethumb; break; } // Grab the file if ($thumbfile && !empty($thumbfile)) { $readfile = new ElggFile(); $readfile->owner_guid = $file->owner_guid; $readfile->setFilename($thumbfile); $mime = $file->getMimeType(); $contents = $readfile->grabFile(); // caching images for 10 days header("Content-type: $mime"); header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+10 days")), true); header("Pragma: public", true); header("Cache-Control: public", true); header("Content-Length: " . strlen($contents)); echo $contents; exit; } }