SVG_New_image

4D - Documentation   Français   English   German   4D SVG Component, Command Theme List   4D SVG Component, Index   Back   Previous   Next

version 11.3


SVG_New_image (parentRef; url{; x; y{; width; height}}) SVG_Ref

ParameterTypeDescription
parentSVGObjectSVG_RefReference of parent element
urlStringAddress of picture
xNumberCoordinate on X axis of upper left corner
yNumberCoordinate on Y axis of upper left corner
widthNumberWidth of picture
heightNumberHeight of picture
Function resultSVG_RefSVG object reference

Description

The SVG_New_image command can be used to reference a picture at the url address in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.

The url parameter specifies the location of the picture and can take several forms:

A local URL (a pathname in the form: file://…): in this case, the picture will only be displayed if the file is actually accessible at the time the picture is rendered. This local URL can be relative (in the form: "#Pictures/myPicture.png"); in this case the command prefixes the pathname with that of the Resources folder of the host database. If the width and height parameters are omitted, they will be calculated by the command (to be avoided since this is slower than when the sizes are known). In the case of a relative path, if it is not valid, an error is generated.

A non-local URL (http://mySite.com/pictures/myPicture.jpeg ). In this case, no verification is carried out concerning the validity of the link and an error will be generated if the width and height parameters are omitted.

The optional x and y parameters can be used to specify the position of the upper left corner of the picture in the SVG containers (default value 0).

The width and height parameters specify the size of the rectangle in which the picture will be displayed and thus determine the size and aspect ratio of the picture. These parameter are only optional in the case of a picture referenced by a relative path in the Resources folder of the host database. If width and/or height equal 0 then the picture is not rendered.

Examples

1. Place the 'logo4D.png' picture located in the 'Pictures' folder of the 'Resources' folder:

   svgRef:= SVG_New 
   objectRef:=SVG_New_image (svgRef;"#Pictures/logo4D.png")

2. Place the '4dlogo.gif' picture that can be accessed in the 'pictures' directory of the '4d.com' site:

   svgRef:= SVG_New
   objectRef:=SVG_New_image (svgRef;"http://www.4d.com/pictures/4dlogo.gif";20;20;39;53)

See Also

SVG_New_embedded_image, SVG_Open_picture.


4D - Documentation   Français   English   German   4D SVG Component, Command Theme List   4D SVG Component, Index   Back   Previous   Next