Autor Thema: in-line image bzw. eingebettes Bild , Exportieren oder als JPEG Abspeichern  (Gelesen 9036 mal)

Offline Klaas

  • Junior Mitglied
  • **
  • Beiträge: 78
  • Geschlecht: Männlich
Hallo,

seit ca. 3 Stunden suche ich nach einer Möglichkeite, Bilder welche in einem Richtext-Feld angezeigt werden zu Exportieren.

Sobald ich via "EmbeddedObjects" auf das Doc zu Greife, wird kein "EMBED_ATTACHMENT" zurück gegeben. Wenn in dem gleichen Feld jedoch eine Datei steht, kann ich damit alles machen. (Die Eigenschaften des Richtextfeldes betiteln den Inhalt einmal als "In-Line Image" und einmal als ATTACHMENT.)

Meine Frage ist nun, gibt es irgend eine Möglichkeit diese Bild wie im Anhang zu sehen zu Exportieren und auf einem Datenträger ab zu legen oder sind die Bilder verloren.

Vielen Dank für Eure mühe....


Offline pram

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.170
  • Geschlecht: Männlich
    • Foconis Object Framework
Über DXL wäre eine Möglichkeit
(oder über Download über den HTTP-Task)

Gruß
Roland

Roland Praml

IBM Certified Application Developer - Lotus Notes and Domino 8
Ich verwende das Foconis Object Framework

Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Stichworte für die AtNotes-Suche: DXL Base64 Image

Bernhard

Offline bikerboy

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.155
  • Geschlecht: Männlich
Daran bin ich auch schon gescheitert, wenn ich den DXL durch den base64 codierer schiebe, kommt da nie ne ordentliche Datei raus. Wäre aber interessiert.
Robert Kreutzer

Anwendungsentwicklung

"Jeder Idiot kann was kompliziertes bauen, es Bedarf eines Genie für etwas einfaches"

Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Ich würde auch eher dekodieren  ;D

Bernhard

Offline pram

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.170
  • Geschlecht: Männlich
    • Foconis Object Framework
Man muss ggf. noch das Flag setzen, dass er es als GIF encodiert. Sonst bekommt man das properitäre Notesbitmap Format

Im DXL findet man dann einen Tag
Code
<gif>
R0lGOD...
</gif>
Base64 codierte GIFs beginnen immer mit "R0lGOD" ;)

Gruß
Roland
Roland Praml

IBM Certified Application Developer - Lotus Notes and Domino 8
Ich verwende das Foconis Object Framework

Offline Klaas

  • Junior Mitglied
  • **
  • Beiträge: 78
  • Geschlecht: Männlich
Vielen Dank für Eure schnellen Antworten.
Den Export in ein xml habe ich hinbekommen.

In der XML ist auf das Bild vorhanden:
"-<item name="fdMAWKdAFotoV">-<richtext> <pardef keeptogether="true" keepwithnext="true" id="1"/> -<par def="1">-<picture height="300px" width="400px">"

aber ich habe noch keinen decoder gefunden welcher das Bild exportieren kann. Als decoder habt ihr doch DXL Base64 vorgeschlagen oder nicht?

Habt ihr vielleicht eine Link wo ich mich weiter einlesen kann?

Offline it898ur

  • Senior Mitglied
  • ****
  • Beiträge: 478
Hallo,

ich hatte auch schon so eine Anforderung und hatte damals folgenden Code im Netz gefunden:

Code
Function ExportPictures(doc As NotesDocument, path As String) As Variant
' ==================================================================
' Exports GIF and JPG images from a notes document into given destinationPath
' Picture's filename is path\<docid>_<number>.<extension>
' Tempfile used is path\Base64.tmp which is deleted after export
' Returns a list of strings containing filenames of exported pictures (if any)
' Base64 conversion is performed with Notes internal MIME functions, therefore
' a tempdoc is created but not saved
' ==================================================================
' by Guido Purper August 2005
' ==================================================================
Dim session As New NotesSession
Dim thisDB As NotesDatabase
Dim doc2 As NotesDocument
Dim filename As String
Dim f As Integer
Dim counter As Integer
Dim destinationPath As String
Dim stream As NotesStream
Dim mimeEntity As NotesMIMEEntity
Dim mimeHeader As NotesMimeHeader
Dim fileList List As String
Dim k(1 To 3, 1 To 3) As String
Dim i As Integer
Dim exporter As NotesDXLExporter
Dim dxl As String
Dim dxlPicture As String
Dim dxlPictureType As String
Dim key As String
Dim p1 As Long
Dim p2 As Long
On Error Goto err1
Set thisDB = session.CurrentDatabase
Set exporter = session.CreateDXLExporter
exporter.ConvertNotesBitmapsToGIF = True
' ================================
' Initialize some variables
' ================================
ExportPictures=""
Erase FileList
' === Key for imported GIFs ===
K(1,1)="<gif>" ' key tag in dxl stream
K(1,2)="</gif>" ' closing tag in dxl stream
K(1,3)="gif" ' file extension
' === Key for any picture converted into gif ===
K(2,1)="<gif originalformat='notesbitmap'>" ' key tag in dxl stream
K(2,2)="</gif>" ' closing tag in dxl stream
K(2,3)="gif" ' file extension
' === Key for JPEGs ===
K(3,1)="<jpeg>" ' key tag in dxl stream
K(3,2)="</jpeg>" ' closing tag in dxl stream
K(3,3)="jpg" ' file extension
' ================================
' Make sure destination path ends with a \
' ================================
If Right$(path,1)="\" Then
destinationPath=path
Else
destinationpath=path & "\"
End If
' ===========================================
' Convert document into DXL
' ===========================================
dxl = exporter.Export(doc)
' ---=== for debugging ===---
' Print "path=" &destinationPath
' f = Freefile
' Print "Debug output to " & destinationPath & "debug.dxl.txt"
' Open destinationPath & "debug.dxl.txt" For Output As f
'Print #f,  DXL
'Close f
'Exit Function
' =========================================
' Remove CRs and LFs from DXL
' =========================================
dxl =  Replace(dxl, Chr$(13), "")
dxl = Replace(dxl, Chr$(10), "")
' ===========================================
' Extract picture data from DXL and write it into tempfile
' ===========================================
For i=1 To 3
key = K(i,1)
p1 = Instr(p1+10, dxl, key , 5)
While p1>0
If p1 >0 Then
p2 =Instr(p1, dxl, k(i,2), 5)
If p2>0 Then
dxlPictureType = K(i,3)
dxlPicture = Mid$(dxl, p1+Len(key), p2-p1-Len(key))
' =====================
' Save DXL into tempfile
' =====================
f = Freefile
Open destinationPath & "Base64.tmp" For Output As f
Print #f,  DXLPicture
Close f
' ===========================================
' Create a new Notes Document with embedded picture
' ===========================================
session.ConvertMIME = False
Set Doc2 = New NotesDocument( ThisDB)
Set MIMEEntity= doc2.CreateMIMEEntity
Set stream = session.CreateStream
If Not stream.Open(path & "Base64.tmp" , "binary") Then
Messagebox "ExportPictures(): Open tempfile failed"
Goto MyExit
End If
If stream.Bytes = 0 Then
Messagebox "ExportPictures(): Tempfile is empty"
Goto MyExit
End If
Call MimeEntity.SetContentFromBytes(stream, "image/gif", ENC_BASE64)
Call stream.Close
' =======================================
'  Save embedded picture to file
' =======================================
Set stream = session.CreateStream
filename = destinationPath & doc.UniversalID & "_" & counter & "." &  dxlPictureType
On Error Resume Next
Kill filename
On Error Goto err1
If Not stream.Open( filename, "binary") Then
Messagebox "ExportPictures(): Cannot write picture " & filename
Goto MyExit
End If
Set MIMEEntity = doc2.GetMIMEEntity
Call MimeEntity.GetContentAsBytes(stream)
Call stream.Close()
FileList(counter) = filename
counter=counter+1
End If ' p2>0
End If 'p1>0
p1 = Instr(p2+1, dxl, key , 5)
Wend
Next i
MyExit:
session.ConvertMIME = True ' Restore conversion
On Error Resume Next
'Kill path & "Base64.tmp"
Call stream.Close()
On Error Goto err1
ExportPictures = FileList
Exit Function
err1:
Print  "ExportPictures(): " & Error$ & " in line " &Erl
Messagebox  "ExportPictures(): " & Error$ & " in line " &Erl
session.ConvertMIME = True
On Error Resume Next
Kill path & "Base64.tmp"
Call stream.Close()
On Error Goto 0
Exit Function
End Function

Ich hoffe das hilft weiter !

Gruß

André

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz