Change picture to hot-picture when resizing ?
Change picture to hot-picture when resizing ?
For html pages you often include large pictures,
which are shown smaller in the document,
and when you click on it, you get the picture in full size.
It would be nice when you make a (large) picture smaller,
that the picture would change automatically to a hot picture
(linked to the orginal picture location).
Is this possible ?
thanks,
which are shown smaller in the document,
and when you click on it, you get the picture in full size.
It would be nice when you make a (large) picture smaller,
that the picture would change automatically to a hot picture
(linked to the orginal picture location).
Is this possible ?
thanks,
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I used the onSaveItemToFile event,
and the implementation (shown below) is very straight forward.
It only adds hotspot information if image is resized.
cheers,
procedure Tform_rve_edit.RVESaveItemToFile(Sender: TCustomRichView;
const Path: String; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: String;
var DoDefault: Boolean);
(*******************************************************************************
*******************************************************************************)
var
filnam :string;
gr :tgraphic;
s :string;
tag :integer;
Valign :trvValign;
w,h :integer;
begin
if (RVData.GetItemStyle(ItemNo)=rvsPicture) or
(RVData.GetItemStyle(ItemNo)=rvsHOTpicture) then
begin
if SaveFormat=rvsfHTML then
begin
TCustomRichViewEdit(Sender).GetPictureInfo(ItemNo,filnam,gr,VAlign,Tag);
filnam:=ExtractRelativePath(This_Filename,filnam);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimagewidth,w);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimageheight,h);
if (gr.Width<>w) or (gr.Height<>h) then
begin
outstr:='<a href="'+filnam+'">'+
'<img width='+inttostr(w)+' height='+inttostr(h)+
' alt=""'+
' src="'+filnam+'"></a>';
dodefault:=false;
end;
end;
end;
end;
and the implementation (shown below) is very straight forward.
It only adds hotspot information if image is resized.
cheers,
procedure Tform_rve_edit.RVESaveItemToFile(Sender: TCustomRichView;
const Path: String; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: String;
var DoDefault: Boolean);
(*******************************************************************************
*******************************************************************************)
var
filnam :string;
gr :tgraphic;
s :string;
tag :integer;
Valign :trvValign;
w,h :integer;
begin
if (RVData.GetItemStyle(ItemNo)=rvsPicture) or
(RVData.GetItemStyle(ItemNo)=rvsHOTpicture) then
begin
if SaveFormat=rvsfHTML then
begin
TCustomRichViewEdit(Sender).GetPictureInfo(ItemNo,filnam,gr,VAlign,Tag);
filnam:=ExtractRelativePath(This_Filename,filnam);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimagewidth,w);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimageheight,h);
if (gr.Width<>w) or (gr.Height<>h) then
begin
outstr:='<a href="'+filnam+'">'+
'<img width='+inttostr(w)+' height='+inttostr(h)+
' alt=""'+
' src="'+filnam+'"></a>';
dodefault:=false;
end;
end;
end;
end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
ok, new try
Code: Select all
procedure Tform_rve_edit.RVESaveItemToFile(Sender: TCustomRichView;
const Path: String; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: String;
var DoDefault: Boolean);
(*******************************************************************************
*******************************************************************************)
var
filnam :string;
gr :tgraphic;
s :string;
tag :integer;
Valign :trvValign;
w,h :integer;
begin
if (RVData.GetItemStyle(ItemNo)=rvsPicture) or
(RVData.GetItemStyle(ItemNo)=rvsHOTpicture) then
begin
if SaveFormat=rvsfHTML then
begin
TCustomRichViewEdit(Sender).GetPictureInfo(ItemNo,filnam,gr,VAlign,Tag);
filnam:=ExtractRelativePath(This_Filename,filnam);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimagewidth,w);
TCustomRichViewEdit(Sender).GetItemExtraIntProperty(ItemNo,rvePimageheight,h);
if (gr.Width<>w) or (gr.Height<>h) then
begin
outstr:='<a href="'+filnam+'">'+
'<img width='+inttostr(w)+' height='+inttostr(h)+
' alt=""'+
' src="'+filnam+'"></a>';
dodefault:=false;
end;
end;
end;
end;