Skip Navigation

[Résolu] image (.jpg) in ‘Embedded Media’ custom field is showing linked url not image

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I have an embed custom field that is mostly used to store image URLs. I would like to be able to display those images, but the embed field displays a clickable URL. How can I display the image instead of its URL?

Solution: You could use the URL to generate an img tag on-demand, or you could convert the embed field to an image field.

Relevant Documentation: https://toolset.com/documentation/customizing-sites-using-php/functions/#embedded-media

This support ticket is created Il y a 4 années et 11 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : 

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

Last updated by martinE-4 Il y a 4 années et 10 mois.

Assisted by: Christian Cox.

Auteur
Publications
#1255821

I am trying to:
Display the image with [types field='common_featured_media' ][/types]
Link to a page where the issue can be seen:

I expected to see:
the image
Instead, I got:
the linked URL

Note, the custom field 'common_featured_media' is of type 'Embedded Media' and has the value hidden link

It shows as a linked URL which when clicked, takes us to the image.

What I would like is to show the image inline on my content template I am creating with VIEWS and the BLOCKS plugin.

#1255823
What_is_ICASC__–_ICASC_MIgration_1.jpg

I just updated all the Toolset plugins so I am running the latest and still have the issue.

#1256389

Hi, typically the "image" custom field type is used to hold and display static images. The "embed" field corresponds to the "embed" feaure of WordPress. It works best with 3rd-party systems like Flickr, Instagram, Vimeo and Vine ( full list available here: https://wordpress.org/support/article/embeds/ ) to display more complex content like videos and galleries. Since the URL you're referring to looks like a static image file, I suggest using an image field type.

Here's more information about the different field types, including the syntax for displaying them:
https://toolset.com/documentation/customizing-sites-using-php/functions/#embedded-media

Let me know if you have additional questions about that.

#1256471

Sorry I realized that. I’m stuck with a migration from drupal using the fg drupal to WordPress migration plugin so I’ve got a database with a lot of data in this field. I think it’s mostly image data. Any way of getting it to display using views?

Many thanks

#1257659

If the field information stored in postmeta is a simple URL to the image file, then you can use that raw data to generate your own image tags on-demand in your template. No conversion is needed - you can use the existing data. The syntax looks something like this:

<img src="[types field='your-embed-field-slug' output='raw'][/types]" />

The raw output type will give you access to the field content exactly as it is stored in postmeta.
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

That works in a pinch, but converting this embed field to an image field is more practical. An image field is really ideal if you want to show the image at different sizes, if you want to use native captions and alt attributes, if you want to crop and pad, if you want to be able to see a preview of the image while editing the post in wp-admin or Forms, and so on.You can manage field types in Toolset > Custom Fields > Post fields. The raw data required for an image field is a simple URL, so you would have to verify the existing information is in the proper format with no extra HTML markup. You should make a complete backup before you attempt this, in case you need to revert something unexpected. If you have created any Forms to create or edit this post type, you should edit the Form. Remove the old embed field and replace it with the new image field.

#1257695

My issue is resolved now. Thank you!

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