Skip Navigation

[Résolu] URL to image that is part of slider

This support ticket is created Il y a 7 années et 7 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Marqué : ,

This topic contains 4 réponses, has 2 voix.

Last updated by chrisH-10 Il y a 7 années et 7 mois.

Assisted by: Luo Yang.

Auteur
Publications
#432828

I am trying to:
Show a slider and allow downloading for the "original" size image(s) or URLs for videos. The downloading can be part of the slider or handled separately below the slider. The user should be able to download the individual item or all items.

I have created the below. This works for the slider, but I can't figure out how to create links to the "original" size version of the images. Maybe a different short code?

<div class="mm-slider">
	<ul>
      [wpv-for-each field="wpcf-mm-images"]<li class="mm-image" data-download="[types field='mm-images' output='raw'][/types]">[types field="mm-images" title="%%TITLE%%" alt="%%ALT%%" class='mm-preview' size='large' align='center' resize='proportional'][/types]</li>[/wpv-for-each]
      [wpv-for-each field="wpcf-mm-videos"]<li class="mm-video" data-download="[types field='mm-videos' output='raw'][/types]">[types field="mm-videos" title="%%TITLE%%" alt="%%ALT%%" class='mm-preview' size='large' align='center' resize='proportional'][/types]</li>[/wpv-for-each]
	</ul>
</div>

For the download all option the best I could come up with was ta field in the admin to allow editors to upload a ZIP that contained the files in question. Extra credit if you have an automated solution...

Example of implementation:
hidden link

#432980

Dear Chris,

You can setup the link by adding HTML a tag, for example, replace the codes from:

[types field="mm-images" title="%%TITLE%%" alt="%%ALT%%" class='mm-preview' size='large' align='center' resize='proportional'][/types]

To:

<a href="[types field="mm-images" size='full'][/types]">[types field="mm-images" title="%%TITLE%%" alt="%%ALT%%" class='mm-preview' size='large' align='center' resize='proportional'][/types]</a>
#433206

This does not work. In what you sent:

[types field="mm-images" size='full'][/types]

will resolve to a complete IMG tag, which is not valid for the href attribute of the a tag. I just need the URL.

#433374

To get the image URL, you can add attribute "url" in the Types shortcode, for example:

[types field="mm-images" size='full' url='true'][/types]

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
url:
'false'(default) | 'true'
true=output the url of the image instead of the html img tag.
Works with the size attribute to output the url of the re-sized image

#433392

Thanks! I found that output="raw" also works, though I suppose that url="true" is superior as that would return a resized image (if that was what's wanted).

Bonus question: Is there a way to get the index of the loop? I would like to show something like
Download Image: 1 2 3 4

I tried hacking something with a <ol>, but that didn't work.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.