getSubtype() != "image") forward('mod/tidypics/graphics/' . $error_image); // Get filename if ($size == "thumb") { $thumbfile = $file->thumbnail; } else if ($size == "small") { $thumbfile = $file->smallthumb; } else { $thumbfile = $file->largethumb; } if (!$thumbfile) forward('mod/tidypics/graphics/' . $error_image); // create Elgg File object $readfile = new ElggFile(); $readfile->owner_guid = $file->owner_guid; $readfile->setFilename($thumbfile); $contents = $readfile->grabFile(); // send error image if file could not be read if (!$contents) { forward('mod/tidypics/graphics/' . $error_image); } // Return the thumbnail and exit $mime = $file->mimetype; header("Content-type: $mime"); echo $contents; exit; ?>