Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added check to get what type of picture and load accordingly as auto detection from...
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 4 Aug 2015 21:31:42 +0000 (22:31 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 4 Aug 2015 21:31:42 +0000 (22:31 +0100)
source/contacteditor/frmContactEditor.cpp

index 34711b0..dd17d98 100644 (file)
@@ -3113,22 +3113,40 @@ void frmContactEditor::LoadPicture( wxListEvent& event )
     std::string base64dec;
     
     std::map<int,std::string>::iterator initier;
+    std::map<int,wxString>::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);
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy