Wordpress - Visual Composer - Get image url from attach_image

How to get image URL from attach_image in Visual Composer

In VC_MAP definition you have:

array(
“type” => “attach_image”,
“heading” => (“Image”, “js_composer”),
“holder” => “div”,
“class” => “”,
“param_name” => “image_url”,
“description” =>
(“Your desc”, “js_composer”)
),

In shortcode function you should have:

 $a = shortcode_atts(array(
‘image_url’ => ‘image_url’,
), $atts);

$img = wp_get_attachment_image_src($a["image_url"], "large");

$imgSrc = $img[0];


Previous article:
How to create component for Visual Composer (js_composer from WP Bakery)