- $res = XDB::query("SELECT attachmime, attach
- FROM aliases
- INNER JOIN photo ON(id = uid)
- WHERE alias = {?}", $x);
-
- if ((list($type, $data) = $res->fetchOneRow())) {
- pl_cached_dynamic_content_headers("image/$type");
- echo $data;
- } else {
- pl_cached_dynamic_content_headers("image/png");
- echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png');
- }
- exit;
+ // Retrieve the photo and its mime type.
+ $photo = $profile->getPhoto(true, true);
+
+ // Display the photo, or a default one when not available.
+ $photo->send();