Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8689077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:32:49+00:00 2026-06-12T23:32:49+00:00

I’m trying to write an Agent which is run via an xmlhttprequest and accepts

  • 0

I’m trying to write an Agent which is run via an xmlhttprequest and accepts
a UNID and a Base64 encoded image as paramater.

What i’m up for is that the agent decodes the base64 string and writes it as an inline Image
into a RichText Field

I tried writing the base64 encoded string to a Stream, then creating a MimeEntity with a Child Entity and set the content from the stream,
Then get the MimeEntity Item and Append it to the RichTextItem

.
.
.
Call stream.Writetext(data)
.
Set body = doc.CreateMIMEEntity("RT")   


Set header = body.CreateHeader("Content-Type") 
Call header.SetHeaderVal("multipart/mixed")
.
Set child = body.CreateChildEntity() 
Call child.Setcontentfrombytes(stream, "image/jpeg", 1727) 
Call child.Decodecontent()
.
Call RT.AppendRTItem(MimeEntityItem)

But I end up with a 6400byte image/jpeg file
And now i don’t get any further

Does anybody has any clues on how to get something like this working ?
Thanks in Advance =)

Edit:

Ok, i figured it just creates a file with the valid base64 string
but it doesn’t get decoded


Ok now i got at least this far:

  Option Public
  Option Declare

  Sub Initialize

      Dim session As NotesSession
      Dim doc As NotesDocument
      Dim query_string As String
      Dim params As Variant
      Dim i As Integer
      Dim db As NotesDatabase
      Set session = New NotesSession
      Set doc = session.DocumentContext
      query_string = doc.QUERY_STRING(0)

  On Error GoTo errorrt
      params = Split (query_string,"&")

      Print("<html><head></head><body>")

      Print params(1);
      Print("<br>")
      Print ({<img src="data:image/png;base64,} & params(2) & {"></img>})
      Set db = session.Currentdatabase
      Set doc = db.Getdocumentbyunid(params(1))
      If doc Is Nothing Then
          Print ("Ne")
      End If
      Print (doc.Getitemvalue("tatkun")(0))
      Print ("</body></html>")

      Call AttachSignature(doc,params(2),"signature")

      Exit Sub
  errorrt:
      Print (Error & " " & erl)
      Exit Sub
  End Sub


  Function AttachSignature(doc As NotesDocument, data As Variant, filename As String) As Boolean

  AttachSignature = False

  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim body As NotesMIMEEntity
  Dim header As NotesMIMEHeader
  Dim child As NotesMIMEEntity
  Dim stream As NotesStream
  Dim fileType As String
  Dim rt1 As NotesRichTextItem
  Dim rt2 As NotesRichTextItem

  On Error GoTo ErrorRoutine

  Set db = doc.Parentdatabase
  Set stream = session.CreateStream

  Call stream.Writetext(data) 'Write the Data to the Stream


  If doc.Getitemvalue("SignatureAttached")(0) = "1" Then
      Exit Function
  End If

  Set body = doc.CreateMIMEEntity("TempRT")     

  Set header = body.CreateHeader("Content-Type") 
  Call header.SetHeaderVal("multipart/mixed")

  Call body.CreateHeader("Content-Disposition"). _
  SetheaderValAndParams({attachment; filename="} &filename & {"})


  Set child = body.CreateChildEntity()

  fileType = "image/jpeg"

      Call child.SetcontentfromText(stream, fileType, 1727) 
      Call stream.Close() 
      Call body.Decodecontent()

  Call doc.save(False, False)

  Set rt1 = doc.GetFirstItem("signature")
  Set rt2 = doc.GetFirstItem("TempRT")

  Call rt1.AppendRTItem( rt2 )
  Call rt2.Remove()

  doc.SignatureAttached = "1"

  Call doc.save(False, False)

  AttachSignature = True

  Exit Function

  ErrorRoutine:
   If Not rt2 Is Nothing Then
      Call rt2.Remove()
   End If 
   Print (Error & " " & Erl)
   Exit Function
  End Function

Which adds a valid image To the RichText item =)

But i don’t get how i could make it an inline image.
And the filename isn’t correct too.

Again Thanx for any help =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:32:51+00:00Added an answer on June 12, 2026 at 11:32 pm

    I believe you want to be using multipart/related instead of multipart/mixed, and assigning a Content-ID: header to the MIMEEntity that stores the iamge, and then using to reference the content ID in your image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.