Can you check if a post WYSIWYG field has an image in it?

There isn’t really a built-in way in WordPress to determine if a content field has an image in it, but you can use standard PHP functions to check. For example, I’ve used a similar technique to check if a post’s featured image has also been inserted into the post content, and if so, haven’t shown the featured image again.

You haven’t included any of your code, so this is just a sample you’ll need to work in to what you already have.

The strpos() function will tell you if a specific string is inside another string. For example:

if( strpos( get_the_content(), '<img ' ) ){ /* this content has an image */ }

You could perhaps use this to add classes to your content container, so you can treat it differently in the CSS:

<?php
$image_class = strpos( get_the_content(), '<img ' ) ) ? 'has-image' : 'no-image';
?>

<div class="post-content <?php echo $image_class; ?>">