Inserting a picture in HTML

Hi,
I want to insert a picture into HTML document. ( Using NT 14.38 and C 11.1).
this code works:
'<p> <img src="C:\A\KEYDROP.JPG" alt="Picture of keys" </>' & '</p>'

BUT IT WILL NOT TAKE A VARIABLE for the name
'<p> <img src="loc:photoname" alt="Picture of keys" </>' (does not work…)

How can I use a variable name for photo to insert into the HTML?
THanks,
Ron

:backhand_index_pointing_up: This is HTML :backhand_index_pointing_up: , one is looking at the C Drive, the other is looking at an object called Loc:PhotoName.

This bit </>’ & ‘ is a clue.

' & ' is standard Clarion string splitting and joining, so maybe the Loc:PhotoName needs to be rewritten like so…

<img src=“' & loc:photoname & '” alt=“Picture of keys” </>’

?

You’re going to have a problem trying to get the web server to serve items other than from your WEB folder, Ron.

Take a look at the Net:f:Filename tag NetTalk WebServer - Basic Introduction and Techniques
or one of the other tags that would let you insert a snippet of text.

Or maybe try

<img src="/images/' & loc:photoname & '" alt=“Picture of keys”  />

Look at the XHTML code in any of the PageHeaderTags generated by the NetTalk wizard to see how it’s embedding an image.

Define “html diocument” in this case.
.htm file on the disk? NetWebPage procedure? NetWebForm?

Hi,
I want to insert the photos into an E mail. I am trying to put them in the Parameter: emLog:MessageHTML
Ron

You want to use CID:Image.ext.

https://www.capesoft.com/docs/NetTalk14/NetTalk3.htm#The_NetEmailSend_Methods

See the method EmbedImages.

This takes a working HTML file (ie double click to view in your web browser), and parses & processes the image location into the CID:Image.ext format and adds the image files to the HTML part of the email as an attachment.

I’m sure Capesoft did a demo app to show a working example. Its a long time since I’ve used Nettalk and some of it has changed alot.

HI,
This created and sent an E mail with the Text AND the photos!

 emLog:MessageHTML ='Kiwi-Kiosk Quick Drop details.' & clip(shopName) &  |
        '<p> Date: ' & loc:dateTime & '</p>' & |
        '<p> Owner: ' & Loc:owner  &  '</p>'  &  |
        '<p> Auto:  ' & loc:mfgr_year &  '</p>' &  |
    '<p> Color: ' & loc:color  &  '</p>' &  |
    '<p> Plate: ' & loc:plate  &  '</p>' &  |
    '<p> Mileage: ' & loc:mileage  &  '</p>' &  |
    '<p> VIN: ' & loc:vinNo   &  '</p>'  & |
        '<p> MESSAGE: ' &  loc:MESSAGE   & '</p>'    & | 
        '<p> <img src=loc:filenameURL    alt="Picture of keys" </>'    & '</p>'   & | 
        ' <p> <img src=sigfilename    alt="Signature" </>'    & '</p>'   
    
     parms.pEmailMessageHTML = emLog:MessageHTML
     parms.pEmailFileList    = loc:photoname & ',' & sigfilename

Not sure I need the <img src or not, but it is for testing so I am leaving it in.
Ron

HI,
Wow, the messaged actually parse out my HTML code - sorry.
Ron

I would start with a simple HTML email, one picture embedded.

There is also this which might work.

This link gives an over view of the problems or differences to expect.

You dont say what your email client is.

If using web based ones, some will block images if they have to be loaded off a website, some wont, its because its useful for tracking when someone reads the email and getting their IP address.

<html>
  <body>
    <img src="http://www.myurl.com/myimage" width="142" height="30" >
  </body>
</html>

In the past, my systems have used the CID (Content-ID) format to embed pics in html like below. It worked but I havent done anything like this in over a decade now and I dont know what new standards have come into play.

<html>
  <body>
    <img src="cid:myimagecid"/>
  </body>
</html>

Anyway if Nettalk doesnt have an example app, see what else exists, or see whats suggested on Nettalk Central.

I cant help you any further.

Img src=“’ & clip(loc:whatever) & '” etc

If you wrap it in lines with 3 backticks then it formats as CODE … which I did to your post. There is a Code button on the toolbar with icon </>