mirror of
https://gitlab.com/octospacc/Snippets.git
synced 2025-06-27 09:02:56 +02:00
Auto-Backup $'Thu Sep 12 2024 01:34:19 GMT+0200 (Central European Summer Time)'
This commit is contained in:
22
LumaBmp2NinJpgConvert.php
Executable file
22
LumaBmp2NinJpgConvert.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php http_response_code(500);
|
||||
|
||||
if (false
|
||||
|| $_SERVER['REQUEST_METHOD'] !== 'POST'
|
||||
|| $_SERVER['HTTP_CONTENT_TYPE'] !== 'image/bmp'
|
||||
|| !str_starts_with($_SERVER['HTTP_USER_AGENT'], 'LumaBmp2NinJpg/')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$jpgFile = '/tmp/php.' . rand() . microtime();
|
||||
$jpgQuality = 100;
|
||||
|
||||
$imageTmp = imagecreatefrombmp('php://input');
|
||||
imagejpeg($imageTmp, $jpgFile, $jpgQuality);
|
||||
imagedestroy($imageTmp);
|
||||
|
||||
header('Content-Type: image/jpg');
|
||||
header('Content-Length: ' . filesize($jpgFile));
|
||||
http_response_code(200);
|
||||
fpassthru(fopen($jpgFile, 'rb'));
|
||||
unlink($jpgFile);
|
Reference in New Issue
Block a user