more docs

This commit is contained in:
Lee 2023-04-09 12:24:47 +01:00
parent 8e75ee4e9b
commit afc56ebebf

@ -35,7 +35,7 @@ function generateRandomString($length = 10): string {
/** /**
* Return a JSON response * Return a JSON response
*/ */
function returnJson($status, $message, $timeTaken = null) { function returnJson($status, $message, $timeTaken = null): void {
$json = array('status' => $status, 'url' => $message, 'processingTime' => round($timeTaken ?? 0, 2) . "ms"); $json = array('status' => $status, 'url' => $message, 'processingTime' => round($timeTaken ?? 0, 2) . "ms");
echo(json_encode($json)); echo(json_encode($json));
die(); die();
@ -79,8 +79,8 @@ try {
if (in_array($fileType, array("png", "jpeg", "jpg"))) { if (in_array($fileType, array("png", "jpeg", "jpg"))) {
$image = imagecreatefromstring(file_get_contents($_FILES["sharex"]["tmp_name"])); $image = imagecreatefromstring(file_get_contents($_FILES["sharex"]["tmp_name"]));
$webp_file = pathinfo($finalName, PATHINFO_FILENAME) . ".webp"; $webp_file = pathinfo($finalName, PATHINFO_FILENAME) . ".webp";
imagewebp($image, $webp_file, 90); imagewebp($image, $webp_file, 90); // Convert the image and save it
imagedestroy($image); imagedestroy($image); // Free up memory
$finalName = $webp_file; $finalName = $webp_file;
$shouldSave = false; $shouldSave = false;
} }