Page 1 of 1

cgsi_getimages get image url

Posted: Mon Nov 23, 2020 7:33 pm
by andrewvideouk
Can some one help me please. I am trying to get a one image url from content or a variable. I have put notag and its still giving me a img tag. What am I doing worng,

output I would like http://site.com/picture.jpg

{cgsi_getimages imagesonly='1' notag='1' }{content}{/cgsi_getimages}

Thank you.

Re: cgsi_getimages get image url

Posted: Mon Nov 23, 2020 9:00 pm
by DIGI3
To get anything other than the tags you need to assign it:

Code: Select all

{cgsi_getimages assign='imageinfo' nocontent=1}{$content}{/cgsi_getimages}
Then you can cycle through the $imageinfo array:

Code: Select all

{foreach from=$imageinfo item=image}
  {$image.src}
{/foreach}
or access an image directly, 0 being the first, e.g.:

Code: Select all

{CGSmartImage src=$imageinfo[0].src noembed=1 max_width=640}

Re: cgsi_getimages get image url

Posted: Thu Nov 26, 2020 2:12 am
by andrewvideouk
Thank you very much you are a life saver. I give it a try.