Getting the first image on a RTF

Discussion in 'Lotus Notes Programming' started by charlymoon, Jun 29, 2021.

  1. charlymoon

    charlymoon New Member

    Joined:
    Jun 29, 2021
    Messages:
    2
    Likes Received:
    0
    I have this site: www.beisbolicos.com, on the first page i used to do a "carousel", this one was made "by hand" on times before bootstrap.
    The carrousel shows the images of a RTF (Rich Text Field) along with the first 100 characters of that field.
    ¿The problem? If the image is inside the "databases images" the image shows OK, but if it is an image from that is a result of a copy paste or a "create new image" (that is not the ones on the database resourses but part of the field) the image does not shows up.
    How do i create that?
    First i create a DIV with a TABLE for every note that will be shown on the carousel, that is using:
    <Div style="position:relative; top:10px;left:10px;bottom:10px;right:-10px; display:none;" id="PrimerNota">
    [<Table style="margin: 10px 10px 10px 10px;" height="100" width="500" bgcolor="#000000">
    <TR height="100">
    <TD height="100">]ONE RTF HERE[</TD><TD height="100" >]ONE TEXT FIELD HERE[</TD>
    </TR>
    </Table>
    </Div>

    Until here everything is OK, on the RTF i will put the image and in the text one the text... On the @Command([RunAgent];"AbrirInicial") i do the following for each table that will form part of the carousel:
    Sub Initialize
    Dim sesion As New NotesSession
    Dim doc2 As NotesDocument
    Dim cdb As NotesDatabase
    Dim columnas As NotesView
    Dim doc As NotesDocument
    Dim rtFoto As NotesRichTextItem
    Dim col As String
    Dim rt As NotesRichTextItem
    Dim titulo As NotesItem
    Dim noticias As NotesView
    Dim nav As Variant
    Dim str1 As String

    Set cdb = sesion.CurrentDatabase 'La base de datos a la que pertenece el documento
    Set doc2 = sesion.DocumentContext 'El documento actual sobre el que corrre el agente
    Set columnas = cdb.GetView("cols") 'La vista sobre la que correrá
    Set noticias = cdb.GetView("nots")

    Set doc = columnas.GetFirstDocument 'El primer documento
    Set rt = doc.Getfirstitem("Texto")
    Set titulo = doc.Getfirstitem("Título")
    str1 = "[<B>]" + titulo.Text + "[</B>] " + rt.GetUnformattedText+"[<BR>]"
    str1 = CalculaString(Left$( str1,400))
    Set rt = doc.GetFirstItem("Foto")
    Set rtfoto = doc2.GetFirstItem("Foto1")
    rtfoto.AppendRTItem rt
    Set rt = doc2.GetFirstItem("Texto1")
    rt.AppendText str1
    rt.AppendDocLink doc,"Ver Mas...", "Ver Mas..."
    ...
    ...
    ...
    Then a Javascript will make the "innerHTML"property of the table cell (the carrousel) to be the same as the innerHTML of the DIV, and the magic is done.
    The again, the question is why do I have just the images resourses but not the "emmbeded" images? and a second question could be ¿how do i get the "embeded image" name in order to migrate to a botstrap based carousel?
    Thanks in advance.
    (BTW, this is made with old Domino 9)
    Greetings
     
    charlymoon, Jun 29, 2021
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.