dir/mod/photo.php
Roland Häder c353b31569
Cleanups:
- don't commit files that are being ignored, better provide a "template" file
  that needs copying to the right file and ignore the file that will have local
  changes like config files will always have.
- fixed CHMOD, no need for executable flag here as the server won't execute
  these files, but only load (read) them
- fixed E_NOTICE in boot.php when entrance/index page (no parameter) is being
  called

Signed-off-by: Roland Haeder <roland@mxchange.org>
2017-03-01 20:00:32 +01:00

31 lines
626 B
PHP

<?php
require_once('datetime.php');
function photo_init(&$a) {
switch($a->argc) {
case 2:
$photo = $a->argv[1];
break;
case 1:
default:
exit;
}
$profile_id = str_replace('.jpg', '', $photo);
$r = q("SELECT * FROM `photo` WHERE `profile-id` = %d LIMIT 1",
intval($profile_id)
);
if(count($r)) {
$data = $r[0]['data'];
}
if(x($data) === false || (! strlen($data))) {
$data = file_get_contents('images/default-profile-sm.jpg');
}
header("Content-type: image/jpeg");
header('Expires: ' . datetime_convert('UTC','UTC', 'now + 1 week', 'D, d M Y H:i:s' . ' GMT'));
echo $data;
exit;
}