From 6139afdbf8a0fced0cb31f1229df8ab85405514f Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sat, 14 Oct 2006 08:31:25 +0000 Subject: Updated example and doc with some code showing how to read embedded object data from a file. --- examples/example3.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/example3.cpp b/examples/example3.cpp index 3b9d2d26..bc9aa4a0 100644 --- a/examples/example3.cpp +++ b/examples/example3.cpp @@ -73,8 +73,21 @@ int main() // -- embed an image (the returned "CID" (content identifier) is used to reference // -- the image into HTML content). - vmime::string cid = textPart.addObject("<...IMAGE DATA...>", - vmime::mediaType(vmime::mediaTypes::IMAGE, vmime::mediaTypes::IMAGE_JPEG)); + vmime::utility::fileSystemFactory* fs = + vmime::platform::getHandler()->getFileSystemFactory(); + + vmime::ref imageFile = + fs->create(fs->stringToPath("/path/to/image.jpg")); + + vmime::ref fileReader = + imageFile->getFileReader(); + + vmime::ref imageCts = + vmime::create + (fileReader->getInputStream(), imageFile->getLength()); + + const vmime::string cid = textPart.addObject(imageCts, + vmime::mediaType(vmime::mediaTypes::IMAGE, vmime::mediaTypes::IMAGE_JPEG)); // -- message text textPart.setText(vmime::create -- cgit v1.2.3