Ah yea i did change the path.
The code i have now is:
function db_category_image( $block_content, $block ) {
$id = get_the_ID();
$category = get_the_category( $id );
$cat_name = $category[0]->cat_name;
if ( ! empty( $block['attrs']['className'] ) && 'cat-image' === $block['attrs']['className'] ) {
$block_content = '
<figure class="gb-block-image has-cat-image">
<img class="cat-image" src="images/category/'.$cd->cat_name.'.webp" height="60" width="100" />
</figure>
';
}
return $block_content;
}