Set LeadImage from 'first image in body'

I have a few hundred documents where the authors have not set leadimage, but they have added image(s) to the body text.

I have a feeling that someone 'fixed something similar' once (maybe it was discussed here).

Have anyone made a script that 'goes through documents body text' and adds the first image as leadimage if there is not leadimage from before?

PS: I do not need to 'modify the body text (keeping the image there is OK)

Thanks, that was super useful information

Deleted...the time required for posting this could have be used for writing the related five or six line...

CastleCMS takes the first image in the body and set it as the leadImage. I don't know if it is part of the main addon, a separate product or a monkey patch.

1 Like