Image
TsgcHTMLComponent_Image — render a Bootstrap image with shape, responsive sizing, lazy loading and an optional lightbox and caption, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_Image — render a Bootstrap image with shape, responsive sizing, lazy loading and an optional lightbox and caption, in Delphi, C++ Builder and .NET.
A picture element with Bootstrap styling. Set the source and alt text, pick a shape, toggle responsive and lazy loading, then read the HTML property.
TsgcHTMLComponent_Image
Bootstrap 5 image markup
Delphi, C++ Builder, .NET
Assign Src and Alt, pick a Shape, toggle Responsive, LazyLoad and Lightbox, then read HTML — or use the static one-line Build helper.
uses
sgcHTML_Enums, sgcHTML_Component_Image;
var
oImg: TsgcHTMLComponent_Image;
begin
oImg := TsgcHTMLComponent_Image.Create(nil);
try
oImg.Src := '/img/team.jpg';
oImg.Alt := 'Our team';
oImg.Shape := isRounded;
oImg.Responsive := True;
oImg.Lightbox := True;
oImg.Caption := 'The team at work';
WebModule.Response := oImg.HTML; // <img> markup
finally
oImg.Free;
end;
end;
// Or in a single line with the static helper:
Result := TsgcHTMLComponent_Image.Build('/img/team.jpg', 'Our team',
isRounded, True);
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Image.hpp
TsgcHTMLComponent_Image *oImg = new TsgcHTMLComponent_Image(NULL);
try
{
oImg->Src = "/img/team.jpg";
oImg->Alt = "Our team";
oImg->Shape = isRounded;
oImg->Responsive = true;
oImg->Lightbox = true;
oImg->Caption = "The team at work";
String html = oImg->HTML; // <img> markup
}
__finally
{
delete oImg;
}
// Or in a single line with the static helper:
String html = TsgcHTMLComponent_Image::Build("/img/team.jpg", "Our team",
isRounded, true);
using esegece.sgcWebSockets;
var img = new TsgcHTMLComponent_Image();
img.Src = "/img/team.jpg";
img.Alt = "Our team";
img.Shape = TsgcHTMLImageShape.isRounded;
img.Responsive = true;
img.Lightbox = true;
img.Caption = "The team at work";
string html = img.HTML; // <img> markup
// Or in a single line with the static helper:
string oneLine = TsgcHTMLComponent_Image.Build("/img/team.jpg", "Our team",
TsgcHTMLImageShape.isRounded, true);
The members you reach for most often.
Src sets the image URL and Alt the accessible alternative text.
Shape (TsgcHTMLImageShape: isRounded, isCircle, isThumbnail) styles the corners and border.
Responsive applies img-fluid so the image scales to its container; Width and Height set explicit dimensions.
LazyLoad adds loading="lazy" so off-screen images defer until needed.
Lightbox wraps the image in a link to the full-size source; Caption wraps it in a figure with a caption; ImageID sets the DOM id.
Build(aSrc, aAlt, aShape, aResponsive) returns the image HTML in a single static call.