Tell us what you are trying to do?
The problem I have is that the image field doesn't have an option to provide the image ID which is required by the VC shortcode.
I'm rather disappointed because this option for image fields I have found reference to back in 2016 as a future feature.
I thought I had solved my problem when I found this code: https://toolset.com/forums/topic/get-id-of-attachment/
The function and shortcode provided does work to give me the information I need. My problem now is that if I try to add it in as a third level of shortcode it breaks the view.
[vc_video link="[types field='video-url' output='raw'][/types]" custom_thumbnail="true" play_icon_animation="scale-up" thumbnail_image="[get-image-id url='[types field='thumbnail-image' output='raw']']"]
The thumbnail_image parameter uses an images ID. which I haven't found any other way to get then creating a shortcode.
Do you see something I missed? I mean how else would use use the code you provided, but inside a third level shortcode?
Is there any documentation that you are following?
https://toolset.com/forums/topic/get-id-of-attachment/
Is there a similar example that we can see?
What is the link to your site?
hidden link It is in the section labeled Featured Video on the right towards the bottom of the homepage.
My goal is to speed up the site by using thumbnails for all videos so Vimeo doesn't have to load so much code on the page. So I created an image field inside my custom post type for videos and am trying to use the VC built in support for thumbnails that open into a lightbox to play the video. I just need to be able to spoon feed it the correct information.
Here is the whole view code if it helps:
[wpv-conditional if="( $(wpcf-thumbnail-image) ne '' )"][vc_row][vc_column][vc_video link="[types field='video-url' output='raw'][/types]" custom_thumbnail="true" play_icon_animation="scale-up" thumbnail_image="[get-image-id url='[types field='thumbnail-image' output='raw']']"][/vc_column][/vc_row][/wpv-conditional]
[wpv-conditional if="( $(wpcf-thumbnail-image) eq '' )"][vc_row][vc_column][vc_video link="[types field='video-url' output='raw'][/types]"][/vc_column][/vc_row][/wpv-conditional]
Show code: [get-image-id url='[types field='thumbnail-image' output='raw']']
The attached images shows what the view does if I remove the [get-image-id] shortcode and just put in the image id directly. The show code was my proof that the get-image-id shortcode works.
Any advice would be greatly appreciated. I'm kind of stumped.