Link to an http image in Editor

  • Hi!

    The customer can create templates for an email in wprichtext combined with wptoolbar.

    I want to give the opportunity to the customer to insert images linked via http. So they should not be embedded but only linked like "<img src='http://domain.com/image.jpg">"

    When the template is loaded and filled with values, the "<img src..." should be as it was. The email client of the customers customer displays the image then... I don't want the images be embedded in the email.

    How can this be done? How can the HTML Code be inserted via wprichtext/wptoolbar? How can the Img be displayed in Designer temporarely?

    Thanks
    Walter

    • Offizieller Beitrag

    The toolbar does not have a button for this. But you can of course just drop a button and connect logic to it.

    Or you intercept the OnToolbarSelectIcon event and insert some code to handle the click.

    In any case -
    If an image TWPImageObject uses the property StreamName to be <>'' this is handled to be either a filename (linked image) or the name of an image in a database or http request.

    Since WPTools does not use internet logic you need to provide the code for this using the event:

    OnHTTPRequestImage.

    Here you create the TWPImageObject and load the data (from file or request).

    To insert such an image use a method like the InsertGraphicDialog

    function InsertGraphicDialog(filter: string = ''; InsertLink: Boolean = FALSE;
    ObjectModes: TWPTextObjModes = []; path : string = ''): TWPObject; virtual;

    You find that code in WPCtrRich.pas and it should be a good example how to do this to insert images.