Inserted Images

General TRichView support forum. Please post your questions here
Post Reply
yabbi
Posts: 10
Joined: Fri Dec 02, 2005 1:52 pm

Inserted Images

Post by yabbi »

If i want to change the src of images' tag when exporting to html, which event i should use? or which section of code i should modified?

And can the rvf link to these images instead of saving them in rvf file.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) You can specify the file name for images in rvespImageFileName item property (see the help file for TRVExtraItemStrProperty).
If rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML

2) You can modify <img src> using OnHTMLSaveImage or OnSaveImage2
(OnSaveImage2 is more easy to use)
yabbi
Posts: 10
Joined: Fri Dec 02, 2005 1:52 pm

Post by yabbi »

Thanks Sergey, I am closing to my wish.

I am using OnHTMLSaveImage and OnRVFPictureNeeded to control the images' saving and loading.

The images is inserted through InsertPicture method, I save the original file name in the name param of InsertPicture. Then I can load them in OnRVFPictureNeeded which has the name param.

However how can i get the name in OnHTMLSaveImage? I need the original file path.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

RVData.GetItemText(ItemNo), where RVData and ItemNo are parameters of OnHTMLSaveImage.
Prismax
Posts: 7
Joined: Wed Mar 28, 2007 6:59 pm

Post by Prismax »

You said you could change the img scr-tag with the onsaveimage2 event. But how can you do that? I tried already lots of things with that event, but none of them worked....

To make myself clear :

I make a html containing images... These images link to local files but need to be saved on a remote server.
Therefore I use the onSaveImage2 event to find the local image and to perform an FTP-upload to the server (where the images is also named "imgx, imgy, etc...).

But the last one is the tricky one. I want to put all these images in a separate folder (richviewimages). The FTP part works but now I only need to change the <img src-tag so that it not contains "<img src='img2.bmp'>" but "<img src='richviewimages/img2.bmp'>".

How can I achieve this?
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use either OnSaveImage2 or OnHTMLSaveImage.
They have the same functionality, but different parameters. Both events allow to modify <img src>. Just assign new file name to Location parameter and set DoDefault parameter to False.

In OnSaveImage2, there is a parameter containing graphic to save. But there is no indication from where this graphic is taken, so you cannot get additional information about this item.
But, if you save image file names where they should be saved, in rvespImageFileName item property, and include rvsoUseItemImageFileNames in the Options parameter of SaveHTML/SaveHTMLEx, the initial value of Location parameter will contain path to this image.

If you will use OnHTMLSaveImage, the graphic to save is identified by RVData and ItemNo parameters. You can get any additional information about this item, for example its name (if ItemNo>=0, RVData.GetItemText(ItemNo)). But this event is more complex to use, because you need to extract graphic yourself. The graphic can be from the following item types: pictures and hotpictures, bullets and hotspots, list markers, tables (background). In addition, it may be a background image for the whole document or for table cell. So I recommend to use OnSaveImage2.
Post Reply