Link to an http image in Editor

WPTools 8 is a complete word processing VCL for Delphi 5 up to Delphi and C++Builder. It integrates powerfull editing features such as footnotes, header and footers, tables and DocX import and export.
klikg
Posts: 2
Joined: Fri May 17, 2013 6:11 am

Link to an http image in Editor

Postby klikg » Mon Jun 12, 2017 6:28 am

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

wpsupport
Site Admin
Posts: 7369
Joined: Fri Oct 24, 2003 4:06 pm
Contact:

Re: Link to an http image in Editor

Postby wpsupport » Mon Jun 12, 2017 10:10 am

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.


Return to “WPTools 7 and 8 (VCL)”



Who is online

Users browsing this forum: No registered users and 1 guest