Image path when HTML saving(Pls hep me :(()

General TRichView support forum. Please post your questions here
Post Reply
Diablomus
Posts: 6
Joined: Sun Sep 09, 2007 4:44 am

Image path when HTML saving(Pls hep me :(()

Post by Diablomus »

Hi.
I looked some topic about HTML image save.
But i didnt understand anything :(
Becaus my english not good:(

My Problem:
I saved HTML file text in richview.
For Example:My HTML file is name Example.htm
1-Richview is creating Example.files directory.
2-Image path is being like 'Example.files/img1.gif' in HTML code.

But i am wanting;
1-Original image path in HTML code (like 'C:\Pic\Cat.bmp').
2-I am not wanting Example.files directory.
How can i do? Pls help me. I didnt understand anything before HTML images topic.
Pls send simple code example.
Thanks for everything. I am waiting:))
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, it's possible to store the original path to image and use it when saving to HTML.
But how do you insert images? Do you use RichViewActions?
Diablomus
Posts: 6
Joined: Sun Sep 09, 2007 4:44 am

Post by Diablomus »

Thanks for asnwer, Sergey.
Yes, i am using RichViewActions.
But i am not knowing how?
Pls give an simple example code or demo.
Thanks fo help...
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In order to store file names for pictures inserted by rvActionInsertPicture1, set rvActionInsertPicture1.StoreFileName = True (RichViewActions version v1.53 or newer is required).

In order to store file names for pictures inserted with RTF, set RichViewEdit1.RTFReadProperties.StoreImagesFileNames = True
(only for external pictures, not for pictures embedded in RTF)

In order to use these file names when exporting to HTML, include rvsoUseItemImageFileNames in rvActionExport1.SaveOptions.

Images with undefined file names (for example, pasted from the Clipboard) will still be saved in subdirectory (or in the same directory, if rvActionExport1.CreateDirectoryForHTMLImages = False)
Diablomus
Posts: 6
Joined: Sun Sep 09, 2007 4:44 am

Post by Diablomus »

Thanks for help:))
I will try.
I hope i can do:))
If i cant do i hopr you can help again:))
Thanks again;)
Diablomus
Posts: 6
Joined: Sun Sep 09, 2007 4:44 am

Post by Diablomus »

Thanks Sergey.
I did.
But i have a new problem now:(
I hope you can help again.
For example:
1-Richview is not creating xxx.files directory. :)
2-Richview is using orginal path for images when exporting html. :) But orginal images paths being see like (.../.../example.jpg)
I must using real orginal path for images when html exporting. :(
Like (C:\Example\example.jpg).
Can i do real orginal path for all images???
Thanks for everything....
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, by default TRichView saves relative paths.
You can override it in OnHTMLSaveImage event:

Code: Select all

procedure TForm3.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;
  RVData: TCustomRVData; ItemNo: Integer; const Path: String;
  BackgroundColor: TColor; var Location: String; var DoDefault: Boolean);
var FileName: String;
begin
  if (ItemNo>=0) and
     RVData.GetItemExtraStrProperty(ItemNo, rvespImageFileName, FileName) and
     (FileName<>'') then begin
    Location := FileName;
    DoDefault := False;
  end;
end;
Diablomus
Posts: 6
Joined: Sun Sep 09, 2007 4:44 am

:)))

Post by Diablomus »

Very thanks Sergey :)).
I could...
Thanks again:))
Post Reply