getSubtype() != "image") forward('mod/tidypics/graphics/img_error.jpg'); // Get filename if ($size == "thumb") { $thumbfile = $file->thumbnail; } else if ($size == "small") { $thumbfile = $file->smallthumb; } else { $thumbfile = $file->largethumb; } error_log('filename is ' . $thumbfile); if (!$thumbfile) forward('mod/tidypics/graphics/img_error.jpg'); // 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/img_error.jpg'); } // Return the thumbnail and exit header("Content-type: image"); echo $contents; exit; ?>