<?php
// phpcs:disable WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL,WordPress.NamingConventions.PrefixAllGlobals -- Modal partial uses plugin-owned tables and local template variables.

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

global $wpdb;

$instant_popup_builder_table_name = $wpdb->prefix . 'instant_popup_builder';

$escaped_table_name = esc_sql($instant_popup_builder_table_name);

$instant_popup_builder_row = $wpdb->get_results($wpdb->prepare("SELECT * FROM `{$escaped_table_name}` where id=%s", $popup_id));

if ($instant_popup_builder_row) {

    $instant_popup_builder_image_url = json_decode($instant_popup_builder_row[0]->content);

    $instant_popup_builder_title = $instant_popup_builder_row[0]->title;

    echo '<img id="popup_image_front" src="' . esc_url($instant_popup_builder_image_url) . '" alt="' . esc_attr($instant_popup_builder_title) . '">';

}

