From ee025a9c43f77d08b14e96803b3eefa4f0536841 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 4 Aug 2015 22:31:42 +0100 Subject: [PATCH] Added check to get what type of picture and load accordingly as auto detection from wxBITMAP_TYPE_ANY doesn't work. --- source/contacteditor/frmContactEditor.cpp | 26 +++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/source/contacteditor/frmContactEditor.cpp b/source/contacteditor/frmContactEditor.cpp index 34711b0..dd17d98 100644 --- a/source/contacteditor/frmContactEditor.cpp +++ b/source/contacteditor/frmContactEditor.cpp @@ -3113,22 +3113,40 @@ void frmContactEditor::LoadPicture( wxListEvent& event ) std::string base64dec; std::map::iterator initier; + std::map::iterator pictypeiter; initier = PicturesList.find(intSelectedData); + pictypeiter = PicturesListPictureType.find(intSelectedData); base64dec = base64_decode(initier->second); - wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size()); wxImage photo; //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size()); - if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){ + wxPuts(wxT("PicType:") + pictypeiter->second); + + if (pictypeiter->second == wxT("image/jpeg")){ - return; + if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){ - } + return; + + } + + } else if (pictypeiter->second == wxT("image/png")){ + + if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){ + + return; + + } + + } else { + + return; + } PictureImage = (wxBitmap)photo; imgPicture->SetBitmap(PictureImage); -- 2.39.5