Title: Database Value
Last modified: February 7, 2021

---

# Database Value

 *  Resolved [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/)
 * (@eyeofthenyte)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/database-value/)
 * I am trying to set a default image so I can pull it for a Discord Embed post.
   I have the webhook working but I can’t find where this url is stored anywhere.
   I’ve scoured the wp_posts and wp_postmeta tables and can’t find where it is even
   referenced. Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Jan-Willem](https://wordpress.org/support/users/janwoostendorp/)
 * (@janwoostendorp)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/database-value/#post-14017910)
 * Hello,
 * The DFI uses the WordPress media library. And it only stores the attachment ID.
   
   Just as a regular featured image. A regular featured image is stored in post_meta`
   _thumbnail_id` per post. The DFI is an image stored in the `wp_options` > `dfi_image_id`
 * In your use case I would download the image, and upload it to the media library.
   
   And save that ID as the `dfi_image_id`.
 * I don’t know how technical you are but [this snippet](https://gist.github.com/m1r0/f22d5237ee93bcccb0d9)
   can download and insert in the media library.
 * Let me know how it goes.
 *  Thread Starter [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/)
 * (@eyeofthenyte)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/database-value/#post-14021127)
 * Ahh I see. I guess I’m more looking to generate a link for said image. I’ll give
   the snippet a try. I’m pretty new to all of this but I think that’s in the media.
   php file. Taking a stab in the dark haha. Thanks for your assistance so far.
 *  Plugin Author [Jan-Willem](https://wordpress.org/support/users/janwoostendorp/)
 * (@janwoostendorp)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/database-value/#post-14024117)
 * What exactly are you trying to do?
    I might be able to point you more in a better
   direction.
 *  Thread Starter [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/)
 * (@eyeofthenyte)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/database-value/#post-14026304)
 * I am trying to make a URL for either the DFI or the normal featured image. I 
   know that I need to reference the the ID but am uncertain how to generate the
   rest of the URL. Place it into the `$thumb_url` variable below so it goes to 
   my websocket appropriately.
    The best I achieved was getting a “default.jpg” 
   at one point but it was essentially just a default missing image icon.
 *     ```
           if ( $new_status != 'publish' || $old_status == 'publish' || $post->post_type != 'post')
               return;
   
           $webhookURL = get_option('discord_webhook_url');
           $id = $post->ID;
   
           //$author = $post->post_author;
           //$authorName = get_the_author_meta('display_name', $author);
           $postTitle = $post->post_title;
           $permalink = get_permalink($id);
           $thumb_url = "default-or-featured-image-url";
           $description = $post->post_excerpt;
           $timestamp = $post->post_date;
   
           $postData = json_encode([
           "content" => "@here A dragonet just dropped off a new parchment: ",
           //"avatar_url" => "image url here",
           // Embeds Array
           "embeds" => [
               [
                   "title" => $postTitle,
                   "type" => "rich",
                   "description" => $description,
                   "url" => $permalink,
                   "timestamp" => $timestamp,
                   "color" => hexdec( "3366ff" ),
                   "footer" => [
                       "text" => "EoN Creations  -  https://eoncreations.com",
                       "icon_url" => "https://eoncreations.com/wp-content/uploads/2020/02/cropped-EggOracle-180x180.png"
                   ],
                   "image" => [
                       "url" => $thumb_url
                   ],
                   "thumbnail" => [
                       "url" => $permalink
                   ]
                   ]
               ]   
           ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
       ```
   
    -  This reply was modified 5 years, 3 months ago by [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/).
    -  This reply was modified 5 years, 3 months ago by [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/).
 *  Plugin Author [Jan-Willem](https://wordpress.org/support/users/janwoostendorp/)
 * (@janwoostendorp)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/database-value/#post-14028930)
 * I’m still not 100% clear on how your process goes, but I don’t think that’s needed
   at this point.
 * To get the url based on an ID there is [wp_get_attachment_url](https://developer.wordpress.org/reference/functions/wp_get_attachment_url/).
   
   Or maybe the WordPress rest API can help you can get pretty much all data using:
   example.com/wp-json/wp/v2/media/YOUR_ID
 *  Thread Starter [eyeofthenyte](https://wordpress.org/support/users/eyeofthenyte/)
 * (@eyeofthenyte)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/database-value/#post-14037503)
 * You were right. I was just messing up with the syntax and arguments within the
   wp_get_attachment_url. Thanks again! Appreciate your help and enjoy the plugin
   as well.
 *  Plugin Author [Jan-Willem](https://wordpress.org/support/users/janwoostendorp/)
 * (@janwoostendorp)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/database-value/#post-14037801)
 * No problem.
 * Good luck 😉

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Database Value’ is closed to new replies.

 * ![](https://ps.w.org/default-featured-image/assets/icon-256x256.jpg?rev=1058491)
 * [Default Featured Image](https://wordpress.org/plugins/default-featured-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/default-featured-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/default-featured-image/)
 * [Active Topics](https://wordpress.org/support/plugin/default-featured-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/default-featured-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/default-featured-image/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [discord](https://wordpress.org/support/topic-tag/discord/)
 * [featured image](https://wordpress.org/support/topic-tag/featured-image/)

 * 7 replies
 * 2 participants
 * Last reply from: [Jan-Willem](https://wordpress.org/support/users/janwoostendorp/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/database-value/#post-14037801)
 * Status: resolved