What’s the best way to trim content from WYSIWYG editor?

wp_strip_all_tags() will strip out all the tags.

However with posts which just have images and no content. There is no solution to that, the excerpt or wherever you are trying to use it will show blank since it cannot “magically” create content for the post when there is no content at all.

For more info > https://codex.wordpress.org/Function_Reference/wp_strip_all_tags