Search.../

src

Sets or gets the file location of the image.

Description

Setting the src property changes the displayed image to the image found at the new src value.

Getting the src property returns the location of the current image file.

The image file can either be an image file from the Media Manager or an external file from any web location.

The URL formats supported are:

  • Images from the Media Manager: wix:image://v1/<uri>/<filename>#originWidth=<width>&originHeight=<height>[&watermark=<watermark_manifest_string>]
  • Images from the web: http(s)://<image url>

    Note: Images from the web will not be transformed. This means the following features are not available: Align, crop, focal point, fitMode, resize, and resolution.

Type:

stringRead & Write, default value is An empty string

Was this helpful?

Get the image's location

Copy Code
1let imageSource = $w("#myImage").src;
2// "wix:image://v1/68d3a9_1de7529c444b4c9eb38401f8efe0cad2.jpg/flowers.jpg#originWidth=1970&originHeight=112
Set the image to be an image from the Media Manager

Copy Code
1$w("#myElement").src = "wix:image://v1/68d3a9_1de7529c444b4c9eb38401f8efe0cad2.jpg/flowers.jpg#originWidth=1970&originHeight=1120";
Set the image to be an image from the web

Copy Code
1$w("#myElement").src = "http://placehold.it/250x250";