/** * Saves an optin image. * * @since 2.0.0 */ function optin_monster_ajax_save_image() { // Prepare variables. $attach_id = absint($_POST['attach']); $optin_id = absint($_POST['id']); $theme = stripslashes($_POST['theme']); $type = stripslashes($_POST['type']); // Set the post thumbnail with the ID provided. set_post_thumbnail($optin_id, $attach_id); // Flush the optin caches. Optin_Monster_Common::get_instance()->flush_optin_caches($optin_id); // Die and send back the image HTML. die(json_encode(optin_monster_ajax_get_image_thumbnail($optin_id, $type, $theme))); }
/** * Gets the image with editing controls for the preview frame. * * @since 2.0.0 * * @return string The image HTML with editing controls. */ public function get_image_with_controls() { return optin_monster_ajax_get_image_thumbnail($this->optin_id, $this->type, $this->theme); }