Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: gfunkus am 12.05.03 - 10:38:36

Titel: Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 10:38:36
Hallo,

Mit welchem Befehl kann man ein Bild (jpg) in ein Dok importieren und auch anzeigen lassen. Das ganze als Attachment anhängen habe ich schon geschafft aber ich würde das Bild in dem Doc gerne angezeigt bekommen. mit der import Methode  hat es irgendwie nicht geklappt???

Gfunkus
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: Notestime am 12.05.03 - 12:27:26
per copy & paste z.b., oder eben als import
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 12:45:55
OK habe das ganze jetzt hinbekommen per LS. Nun meine nächste Frage weiss jemand wie man die Grösse des RTF limitiert um ein Bild mit 1200*xxxx auf z.b 800x600 zu shrinken????
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 12:48:57
oder kenn evtl. jemand ein Third Party Tool um so etwas bequem evtl. per Batch zu lösen???

Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 13:44:19
wie sieht es mit HTML aus??? kann man da keine Attreibute setzen um die grösse im Browser festzulegen???
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 14:44:49
Hallo,

mein Skript schiesst sich nach 20 oder 30 durchläufen immer ab.
ich gehe davon aus das er das uidoc nicht wieder schliesst... kann mjir wer helfen???

hier der quellcode...



Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim rtitem As NotesRichTextItem
   Dim object As NotesEmbeddedObject
   Dim filename As String
   Dim ImageType As String
   Dim ImageHeight As String
   Dim ImageWidth As String
   Dim ImageDepth As String
   
   ' Open a dialogbox and allow users to select from a list of files
   ' NB: PNG is missing from here as Notes can't import PNG image types.
   Albumname = Inputbox("Bitte geben sie einen Namen für das neue Album ein: ")
   
   files = workspace.OpenFileDialog(True, "File List", "Supported Images|*.jpg;*.bmp;*.gif", "C:\")
   If Isempty(files) Then Exit Sub      ' Exit if the user selects the Cancel button
   Forall FileList In files                ' Loop through the list of files selected
      Filename = Filelist            ' Get the current filename
      ' GetImageProperties returns an array of ImageType, height, width and bit-depth
      imgProps = GetImageProperties(Filename)
      ImageType = imgProps(0)      ' Get the image type, BMP-GIF-JPEG-PNG
      ImageHeight = imgProps(1)   ' Get the image height
      ImageWidth = imgProps(2)   ' Get the image width
      ImageDepth = imgProps(3)   ' Get the image bit-depth
      
      ' Now, we will create a new document and attach the selected image to it.
      Set db = session.CurrentDatabase                  ' Get the current database
      Set doc = New NotesDocument( db )               ' Create a new Notes Doc
      Set rtitem = New NotesRichTextItem( doc, "Image" )   ' Create a new richtext item
      'Set object = rtitem.EmbedObject    ( EMBED_ATTACHMENT, "", filename) ' Attach the file to it
      doc.Form = "ImageSize"               ' Set the form name
      doc.HEIGHT = Cint(ImageHeight)         ' Write the height
      doc.Width = Cint(ImageWidth)         ' Write the width
      doc.colordepth = Cint(ImageDepth)      ' Write the colour depth
      doc.filesize = Filelen(filename)         ' Write the filename
      Call doc.Save( True, True )            ' Save the backend document
      ' Once we have attached the image, we can open the document in the front-end and
      ' import the same file so we have a preview version.
      Set uidoc = workspace.EditDocument( True, doc )   ' Open the backend doc in the UI
      Call uidoc.GotoField( "ImageView" )                  ' Make the ImageView field the focus
      
      Select Case Imagetype                           ' Select which image type this file is
      Case "GIF":
         Call uidoc.Import("GIF Image",filename)            ' Import the GIF image into the field
         Call uidoc.fieldsettext("ImageType", "GIF Image")   ' Set the Image type field
      Case "JPEG":
         Call uidoc.Import("JPEG Image",filename)         ' Import the JPEG image into the field
         Call uidoc.fieldsettext("ImageType", "JPEG Image")   ' Set the Image type field
      Case "PNG":
         ' NB: This will never happen as Notes doesn't import PNG files although it's there if we need it
         Call uidoc.Import("PNG Image",filename)         ' Import the PNG image into the field
         Call uidoc.fieldsettext("ImageType", "PNG Image")   ' Set the Image type field
      Case "BMP":
         Call uidoc.Import("BMP Image",filename)         ' Import the BMP image into the field
         Call uidoc.fieldsettext("ImageType", "BMP Image")   ' Set the Image type field
      End Select
      
      Call uidoc.FieldSetText("Filename", filename)   ' Set the filename field
      Call uidoc.FieldSetText("Albumtitle", Albumname)
      'uidoc.CollapseAllSections   ' Collapse the preview section
      Call uidoc.save               ' Save the UI Doc
      Call uidoc.close               ' Close the UI Doc
   End Forall         ' loop through any of the remaining files
End Sub
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 12.05.03 - 15:56:13
Habe gerade im Forum bei IBM gelesen das es ich wohl um einenn R& BUG handelt??? nach 25 Durchläufen hängt sich das uidoc auf???

Hat einer noch eine andere Idee für einen Grafik Import???
Wäre für eine BACKEND Lösung... wäre auch schneller...


MFG


Gfunkus
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 13.05.03 - 10:00:08
Kann denn niemand helfen???


HILFE!!!!!
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: Thomas Schulte am 14.05.03 - 12:03:06
Was dein Script angeht, ersetze
Call uiDoc.Close durch
Call uiDoc.Close(True)
dann hängt er sich auch nicht mehr auf.
ACHTUNG: Funktioniert erst ab V5.0.10 sicher. Vorherige Versionen ergeben da eine Fehlermeldung.
Was deinen Rest angeht, Ich würde das auf unterschiedlichen Ebenen Lösen. Zuerst würde ich ein Thumbnail in der entsprechenden Größe generieren. Dieses über den Import in das Dokument reinpacken und anschließend dann das orginalfile als Attachment anhängen. Auf die Art bekommst du vernünftige Bildgrößen hin und wenn jemand das große Bild haben will kann er über den Link gehen.

Thomas
Titel: Re:Bild im Dokument anzeigen?
Beitrag von: gfunkus am 14.05.03 - 12:45:29
Super Danke!!!!!!! :D

Hat Funktioniert...

Gute Idee... arbeite gerade an einer Variante, welches die Thumbs mit einem externen Tool selbst generiert...