// retrieves the attachment ID from the file URL
function ll_get_image_id($image_url) {
global $wpdb;
// If testing locally
$image_url = str_replace('//localhost:3000', site_url(), $image_url);
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
return $attachment[0];
}