ENH:image to base64&supports uppercase file names
the issue occurs when trying to convert an image with uppercase file names to base64 format. Change-Id: I1b3b4b95ae5602affc7c2d7c584fdc459d90ee0d
This commit is contained in:
parent
54d5e9df8f
commit
ee478072c8
|
@ -324,11 +324,14 @@ std::map<std::string, std::vector<json>> ProjectPanel::Reload(wxString aux_path)
|
||||||
pfile_obj["filename"] = wxGetApp().url_encode(file_path_obj.filename().string().c_str());
|
pfile_obj["filename"] = wxGetApp().url_encode(file_path_obj.filename().string().c_str());
|
||||||
pfile_obj["size"] = formatBytes((unsigned long)filelen);
|
pfile_obj["size"] = formatBytes((unsigned long)filelen);
|
||||||
|
|
||||||
|
std::string file_extension = file_path_obj.extension().string();
|
||||||
|
boost::algorithm::to_lower(file_extension);
|
||||||
|
|
||||||
//image
|
//image
|
||||||
if (file_path_obj.extension() == ".jpg" ||
|
if (file_extension == ".jpg" ||
|
||||||
file_path_obj.extension() == ".jpeg" ||
|
file_extension == ".jpeg" ||
|
||||||
file_path_obj.extension() == ".png" ||
|
file_extension == ".png" ||
|
||||||
file_path_obj.extension() == ".bmp")
|
file_extension == ".bmp")
|
||||||
{
|
{
|
||||||
|
|
||||||
wxString base64_str = to_base64(file_path);
|
wxString base64_str = to_base64(file_path);
|
||||||
|
@ -363,7 +366,9 @@ wxString ProjectPanel::to_base64(std::string file_path)
|
||||||
base64_format[".png"] = wxBITMAP_TYPE_PNG;
|
base64_format[".png"] = wxBITMAP_TYPE_PNG;
|
||||||
base64_format[".bmp"] = wxBITMAP_TYPE_BMP;
|
base64_format[".bmp"] = wxBITMAP_TYPE_BMP;
|
||||||
|
|
||||||
|
|
||||||
std::string extension = file_path.substr(file_path.rfind("."), file_path.length());
|
std::string extension = file_path.substr(file_path.rfind("."), file_path.length());
|
||||||
|
boost::algorithm::to_lower(extension);
|
||||||
|
|
||||||
auto image = new wxImage(encode_path(file_path.c_str()));
|
auto image = new wxImage(encode_path(file_path.c_str()));
|
||||||
wxMemoryOutputStream mem;
|
wxMemoryOutputStream mem;
|
||||||
|
|
Loading…
Reference in New Issue