If it is post-thumbnail, it will return the ID:-
<?php $post_thumbnail_id = get_post_thumbnail_id( $post_id ); ?>
try this.
If it is post-thumbnail, it will return the ID:-
<?php $post_thumbnail_id = get_post_thumbnail_id( $post_id ); ?>
try this.