mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fixed avatar service
This commit is contained in:
@@ -53,11 +53,11 @@ $avatarCallback = function ($type, $code, $width, $height, $quality, $response)
|
||||
if ($data) {
|
||||
//$output = (empty($output)) ? $type : $output;
|
||||
|
||||
$response
|
||||
return $response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'hit')
|
||||
->send($data, 0)
|
||||
->send($data)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -67,19 +67,17 @@ $avatarCallback = function ($type, $code, $width, $height, $quality, $response)
|
||||
|
||||
$output = (empty($output)) ? $type : $output;
|
||||
|
||||
$data = $resize->output($output, $quality);
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'miss')
|
||||
->send('', null)
|
||||
->send($data, null);
|
||||
;
|
||||
|
||||
$data = $resize->output($output, $quality);
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response->send($data, null);
|
||||
|
||||
unset($resize);
|
||||
};
|
||||
|
||||
@@ -158,11 +156,11 @@ App::get('/v1/avatars/image')
|
||||
$data = $cache->load($key, 60 * 60 * 24 * 7 /* 1 week */);
|
||||
|
||||
if ($data) {
|
||||
$response
|
||||
return $response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'hit')
|
||||
->send($data, 0)
|
||||
->send($data)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -185,19 +183,18 @@ App::get('/v1/avatars/image')
|
||||
$resize->crop((int) $width, (int) $height);
|
||||
|
||||
$output = (empty($output)) ? $type : $output;
|
||||
|
||||
$data = $resize->output($output, $quality);
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'miss')
|
||||
->send($data);
|
||||
;
|
||||
|
||||
$data = $resize->output($output, $quality);
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response->send($data, null);
|
||||
|
||||
unset($resize);
|
||||
}, ['response']);
|
||||
|
||||
@@ -225,11 +222,11 @@ App::get('/v1/avatars/favicon')
|
||||
$data = $cache->load($key, 60 * 60 * 24 * 30 * 3 /* 3 months */);
|
||||
|
||||
if ($data) {
|
||||
$response
|
||||
return $response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'hit')
|
||||
->send($data, 0)
|
||||
->send($data)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -318,11 +315,11 @@ App::get('/v1/avatars/favicon')
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response
|
||||
return $response
|
||||
->setContentType('image/x-icon')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'miss')
|
||||
->send($data, 0)
|
||||
->send($data)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -338,17 +335,16 @@ App::get('/v1/avatars/favicon')
|
||||
|
||||
$output = (empty($output)) ? $type : $output;
|
||||
|
||||
$response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'miss')
|
||||
;
|
||||
|
||||
$data = $resize->output($output, $quality);
|
||||
|
||||
$cache->save($key, $data);
|
||||
|
||||
$response->send($data, null);
|
||||
$response
|
||||
->setContentType('image/png')
|
||||
->addHeader('Expires', $date)
|
||||
->addHeader('X-Appwrite-Cache', 'miss')
|
||||
->addHeader('X-Appwrite-Debug', '1')
|
||||
->send($data);
|
||||
|
||||
unset($resize);
|
||||
}, ['response']);
|
||||
|
||||
Reference in New Issue
Block a user