mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-26 20:04:45 +01:00
Add image for default preview.
This commit is contained in:
parent
56dd60b474
commit
1deff5ac24
BIN
no-image.jpg
Normal file
BIN
no-image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
@ -4,6 +4,7 @@
|
||||
namespace TelegramApiServer\MadelineProtoExtensions;
|
||||
|
||||
|
||||
use Amp\ByteStream\ResourceInputStream;
|
||||
use Amp\Delayed;
|
||||
use Amp\Http\Server\FormParser\StreamedField;
|
||||
use Amp\Http\Server\Request;
|
||||
@ -429,7 +430,15 @@ class ApiExtensions
|
||||
$thumb = $media['photo']['sizes'][array_key_last($media['photo']['sizes'])];
|
||||
break;
|
||||
default:
|
||||
throw new UnexpectedValueException('Message has no preview');
|
||||
$stream = fopen(ROOT_DIR . '/no-image.jpg', 'rb');
|
||||
return new Response(
|
||||
200,
|
||||
[
|
||||
'Content-Type' => 'image/jpeg',
|
||||
'Content-Length'=> fstat($stream)['size'],
|
||||
],
|
||||
new ResourceInputStream($stream)
|
||||
);
|
||||
|
||||
}
|
||||
$info = yield $this->madelineProto->getDownloadInfo($thumb);
|
||||
|
Loading…
Reference in New Issue
Block a user