+
+#if wxUSE_FILESYSTEM
+ if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY)
+ {
+#if 0
+ if (!image->GetImage().IsOk() && image->GetImageBlock().GetData())
+ image->LoadFromBlock();
+ if (image->GetImage().IsOk() && !image->GetImageBlock().GetData())
+ image->MakeBlock();
+#endif
+
+ if (image->GetImageBlock().IsOk())
+ {
+ wxImage img;
+ image->GetImageBlock().Load(img);
+ if (img.IsOk())
+ {
+ wxString ext(image->GetImageBlock().GetExtension());
+ wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, ext.c_str()));
+ wxMemoryFSHandler::AddFile(tempFilename, img, image->GetImageBlock().GetImageType());
+
+ m_imageLocations.Add(tempFilename);
+
+ str << wxT("memory:") << tempFilename;
+ }
+ }
+ else
+ str << wxT("memory:?");
+
+ sm_fileCounter ++;
+ }
+ else if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES)
+ {
+#if 0
+ if (!image->GetImage().IsOk() && image->GetImageBlock().GetData())
+ image->LoadFromBlock();
+ if (image->GetImage().IsOk() && !image->GetImageBlock().GetData())
+ image->MakeBlock();
+#endif
+
+ if (image->GetImageBlock().IsOk())
+ {
+ wxString tempDir(GetTempDir());
+ if (tempDir.IsEmpty())
+ tempDir = wxFileName::GetTempDir();
+
+ wxString ext(image->GetImageBlock().GetExtension());
+ wxString tempFilename(wxString::Format(wxT("%s/image%d.%s"), tempDir.c_str(), sm_fileCounter, ext.c_str()));
+ image->GetImageBlock().Write(tempFilename);
+
+ m_imageLocations.Add(tempFilename);
+
+ str << wxFileSystem::FileNameToURL(tempFilename);
+ }
+ else
+ str << wxT("file:?");
+
+ sm_fileCounter ++;
+ }
+ else // if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64) // this is implied
+#endif
+ {
+ str << wxT("data:");
+ str << GetMimeType(image->GetImageBlock().GetImageType());
+ str << wxT(";base64,");
+#if 0
+ if (image->GetImage().IsOk() && !image->GetImageBlock().GetData())
+ image->MakeBlock();
+#endif
+ if (image->GetImageBlock().IsOk())
+ {
+ wxChar* data = b64enc( image->GetImageBlock().GetData(), image->GetImageBlock().GetDataSize() );
+ str << data;
+
+ delete[] data;
+ }
+ }
+