trichview.com

trichview.support.examples




Re: how to to paste images (without big blob sizes in db)


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/31/2005 13:27:37


I recommend to use Png instead of Jpeg.

Jpegs are good to show photos, but very bad to show screenshots or schemes.


You can convert all images to PNG (use PngObject

(http://pngdelphi.sourceforge.net/) to represent png images)

And call RV_RegisterPngGraphic(TPngObject) to allow TRichView to save and

load PNG in RTF files.


How to convert all bitmaps to png:


procedure TForm1.EnumItemsProc(RVData: TCustomRVData;

  ItemNo: Integer; var UserData1: Integer; const UserData2: String;

  var ContinueEnum: Boolean);

var gr: TGraphic;

    png: TPngObject;

    Tag: Integer;

    VAlign: TRVVAlign;

    s: String;

begin

  if RVData.GetItem(ItemNo) is TRVGraphicItemInfo then begin

    RVData.GetPictureInfo(ItemNo,s,gr,VAlign,Tag);

    if gr is TBitmap then begin

      png := TPNGObject.Create;

      png.Assign(gr);

      RVData.SetPictureInfo(ItemNo,s,png,VAlign,Tag);

    end;

  end;

  ContinueEnum := True;

end;


Call:


var v: Integer;

begin

  v := 0;

  RichViewEdit1.RVData.EnumItems(EnumItemsProc, v, '')

end;


You can call this procedure before saving document.


PS: Please post questions in trichview.support



> im trying to paste bitmaps in to dbrichview edit. it is ok but when i

check

> the db size it is very big. im importing same file with an open dialog

then

> db size increases the only file size... (this is ok then)

>

> But how could i control the paste routine and convert all pasted bitmaps

in

> to jpeg bitmaps..

>

> Also if i import a html file with image links does the rv import images

> also. (same question for rtf)

>

> (im working on a knowledge base utility. i will try to collect information

> weblink web pages in to one data file.. it will be a free utility)...

>

> regards...

>

>

>

>






Powered by ABC Amber Outlook Express Converter