Skip to content

Commit

Permalink
fix: fileToBase64 function
Browse files Browse the repository at this point in the history
  • Loading branch information
bgastaldi authored Jul 10, 2023
1 parent 010672a commit 1c894ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function logger(string $path, object $data, bool $serialize = false): voi
*/
public function fileToBase64(string $filePath): string
{
$finfo = new \finfo(FILEINFO_MIME_TYPE);
return 'data:' . $finfo->file($filePath) . ';base64,' . base64_encode(file_get_contents($filePath));
$type = image_type_to_mime_type(exif_imagetype($filePath));
return 'data:' . $type . ';base64,' . base64_encode(file_get_contents($filePath));
}

/**
Expand Down

0 comments on commit 1c894ac

Please sign in to comment.