1

I need to reference an image in a rich text field separately to the text.

So I can't just use {{entry.body}} I need to be able to do {{entry.body.image}} or something comparable.

How can I do something like this?

Hopefully my question makes sense, I am new to Craft.

Thanks!

1

Sounds like you are coming from something like WordPress. In Craft there are asset fields where you can relate assets to your text. Together with matrix fields you can create a powerful layout rather than inserting everything into one huge wysiwyg.

If you really want to fetch images in html editors you'll need a plugin for that. It's not possible in Craft per default because it's not really the intended way

  • I'm just migrating from Wordpress. In fact, we spoke before, you helped me with displaying some images on my site. The posts I am migrating have their images within a rich text field, instead of in the featured image field. I guess I need a way to migrate my image from the rich text field in Wordpress into the asset field for Craft. Have you ever done this before? – timbutcher Jan 28 '18 at 9:18
  • Ah now I remember.. Well as I said before, forget everything you know about WordPress - you should not use Craft the way WordPress is used. Why do you even want to access images in html editors? Maybe you can do something with reg ex but if you just want to use wp methods you should drop your idea in the client's sake – Robin Schambach Jan 28 '18 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.