Converter and direct BASE64 files

This commit is contained in:
2023-11-17 04:31:38 +01:00
parent 8269718126
commit c693c96100
6 changed files with 178 additions and 8 deletions
+5 -5
View File
@@ -14,11 +14,11 @@
namespace khofmann
{
/// <summary>
/// Read a file and return BASE64 encoded file contents
/// Read a file and return file contents
/// </summary>
/// <param name="path">Path of File</param>
/// <param name="path">Path of BASE64 encoded File</param>
/// <param name="alloc">Allocator</param>
/// <returns>BASE64 encoded file contents</returns>
/// <returns>File contents</returns>
static rapidjson::Value readFile(const char* path, rapidjson::Document::AllocatorType& alloc)
{
FILE* file = fopen(path, "r");
@@ -31,7 +31,7 @@ namespace khofmann
fread(string, fsize, 1, file);
fclose(file);
return rapidjson::Value(macaron::Base64::Encode(string, fsize).c_str(), alloc);
return rapidjson::Value(string, alloc);
}
return rapidjson::Value("", alloc);
@@ -63,7 +63,7 @@ namespace khofmann
std::string dirPath(path);
dirPath += dir->d_name;
std::string thumb(dirPath);
thumb += "/thumb.png";
thumb += "/thumb.bjpg";
FILE* check = fopen(thumb.c_str(), "r");
if (check)
{