$object->profilepicture = "http://i.imgur.com/tmqV1Vo.png"; } $object->likes = count(LikedBoxSnap::get_all_by_boxsnapid($object->id)); $object->comments = count(BoxSnapComment::get_all_by_boxsnapid($object->id)); if (isset($_GET['username'])) { if (LikedBoxSnap::exists($object->id, $_GET['username'])) { $object->liked = true; } } } } $response = $objects; } else { if ($_GET['object'] == "wallpost") { $sql = "SELECT * FROM " . T_WALLPOSTS . " WHERE " . C_WALLPOST_TOUSERNAME . "='" . $_GET['tousername'] . "' ORDER BY id DESC LIMIT 20"; $objects = WallPost::get_by_sql($sql); $filename = 0; if (count($objects) > 0) { foreach ($objects as $object) { $theFile = "images/boxsnaps/" . $object->id . ".jpg"; if (!file_exists($theFile)) { file_put_contents($theFile, base64_decode($object->picture)); } else { if (filesize($theFile) == 0) { file_put_contents($theFile, base64_decode($object->picture)); } } $object->picture = HOST . "includes/webservices/images/wallposts/" . $object->id . ".jpg"; // EXTENDED PROFILE PICTURE $toextendedprofile = ExtendedProfile::get_by_username($object->tousername); if ($extendedprofile && $extendedprofile->picture) {