Elementor\Group_Control_Image_Size::get_attachment_image_src PHP Method

get_attachment_image_src() public static method

public static get_attachment_image_src ( $attachment_id, $group_name, $instance )
    public static function get_attachment_image_src($attachment_id, $group_name, $instance)
    {
        if (empty($attachment_id)) {
            return false;
        }
        $size = $instance[$group_name . '_size'];
        if ('custom' !== $size) {
            $attachment_size = $size;
        } else {
            // Use BFI_Thumb script
            // TODO: Please rewrite this code
            require_once ELEMENTOR_PATH . 'includes/libraries/bfi-thumb/bfi-thumb.php';
            $custom_dimension = $instance[$group_name . '_custom_dimension'];
            $attachment_size = ['bfi_thumb' => true, 'crop' => true];
            $has_custom_size = false;
            if (!empty($custom_dimension['width'])) {
                $has_custom_size = true;
                $attachment_size[0] = $custom_dimension['width'];
            }
            if (!empty($custom_dimension['height'])) {
                $has_custom_size = true;
                $attachment_size[1] = $custom_dimension['height'];
            }
            if (!$has_custom_size) {
                $attachment_size = 'full';
            }
        }
        $image_src = wp_get_attachment_image_src($attachment_id, $attachment_size);
        return !empty($image_src[0]) ? $image_src[0] : '';
    }