WordPress has a built-in function for this: attachment_url_to_postid()
.
More info from a Stack Overflow question: Get Attachment ID by File Path in WordPress.
WordPress has a built-in function for this: attachment_url_to_postid()
.
More info from a Stack Overflow question: Get Attachment ID by File Path in WordPress.