vae_image() and vae_sizedimage()
Use the vae_image()
or vae_sizedimage()
function to generate a URL
for an image uploaded through Vae. The value returned by these functions
is typically used within the src=
attribute of an <img>
tag. The URL
is returned relative to the Vae data URL, which you can retrieve using
the vae_data_url()
function.
Currently, returned URLs do not contain slashes, however, this is not guaranteed, and may change in the future.
Usage
vae_image($image_id, $width = "", $height = "", $image_size_name = "", $grow = false, $quality = "")
-
$image_id
- ID of the image you wish you display. This is obtained by reading the data returned byvae()
under the path of the Image structure you wish to use. -
$width
and$height
[(optional)] - the image will be scaled (resized) to this maximum width and height, preserving aspect ratio. -
$image_size_name
[(optional)] - if you set up a specific image resizing task in Vae (such as cropping), simply pass in the name of that image size task here to obtain the image as sized by that task. -
$grow
[(optional)] - set totrue
if you would like the image to be enlarged to fit the specified size in the event that it is smaller than the specified width and height. If this is set tofalse
(default), Vae will never enlarge images to meet your width and height specifications. -
$quality
[(optional)] - set to an integer from 1 to 100 to define the JPG quality of the image. If the image is not a JPEG, this value is ignored.
OR
vae_sizedimage($image_id, $image_size_name)
-
$image_id
- ID of the image you wish you display. This is obtained by reading the data returned byvae()
under the path of the Image structure you wish to use. -
$image_size_name
- if you set up a specific image resizing task in Vae (such as cropping), simply pass in the name of that image size task here to obtain the image as sized by that task.
Returns
Filename of the local copy of this image, relative to the local Vae data cache path.