mirror of
https://gitlab.com/octospacc/Snippets.git
synced 2025-03-12 14:40:09 +01:00
Auto-Backup $'Fri Jan 03 2025 02:33:10 GMT+0100 (Central European Standard Time)'
This commit is contained in:
parent
cf5165389d
commit
958f00da36
@ -1,9 +1,8 @@
|
||||
<?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/')
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST'
|
||||
|| $_SERVER['HTTP_CONTENT_TYPE'] !== 'image/bmp'
|
||||
|| !str_starts_with($_SERVER['HTTP_USER_AGENT'], 'LumaBmp2NinJpg/')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -15,6 +14,13 @@ $imageTmp = imagecreatefrombmp('php://input');
|
||||
imagejpeg($imageTmp, $jpgFile, $jpgQuality);
|
||||
imagedestroy($imageTmp);
|
||||
|
||||
if ($fileName = $_SERVER['HTTP_X_FILE_NAME']) {
|
||||
if ($dateTime = date_create_from_format("Y-m-d_G-i-s", explode('.', $fileName)[0])) {
|
||||
$dateTime = $dateTime->format('Y:m:d G:i:s');
|
||||
exec("exiftool -overwrite_original -CreateDate='{$dateTime}' -ModifyDate='{$dateTime}' -FileModifyDate='{$dateTime}' -DateTime='{$dateTime}' -DateTimeOriginal='{$dateTime}' -DateTimeDigitized='{$dateTime}' {$jpgFile}");
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-Type: image/jpg');
|
||||
header('Content-Length: ' . filesize($jpgFile));
|
||||
http_response_code(200);
|
||||
|
Loading…
x
Reference in New Issue
Block a user