画像情報はデータベースに記録される
メディアアップローダを介してアップロードされた画像は、サーバのディレクトリ中に格納されるとともに、wordpressデータベースのwp_postsというテーブルに画像パス(URI)に紐づけてID、ファイル名、アップロード時間などの情報が記録される
wp_postsテーブル
| パラメータ | 意味 | 値の例 |
|---|---|---|
| ID | ID | 1501 |
| post_author | 投稿者 | 1 |
| post_date | 画像をアップロードした日時 | 2015-02-10 12:07:45 |
| post_date_gmt | 画像をアップロードした日時 | 2015-02-10 3:07:45 |
| post_content | 本文(画像の場合は空白) | |
| post_title | 画像のタイトル | 1139150245147 |
| post_excerpt | 抜粋文(画像の場合は空白) | |
| post_status | 画像の状態 | inherit |
| comment_status | open | open |
| ping_status | open | open |
| post_password | パスワード(設定されていなければ空白) | |
| post_name | 画像の名前 | 1139150245147 |
| to_ping | ピン先 | |
| pinged | ピンバックした履歴 | |
| post_modified | 画像を更新した日時 | 2015-02-10 12:07:45 |
| post_modified_gmt | 画像を更新した日時 | 2015-02-10 3:07 |
| post_content_filtered | 画像の場合は意味なし | |
| post_parent | 親投稿(画像が使われている投稿のID) | 1502 |
| guid | 画像のパス(URI) | https://unskilled.site/wp-content/uploads/2015/02/1139150245147.jpg |
| menu_order | 画像の場合は意味なし | 0 |
| post_type | 種類 | attachment |
| post_mime_type | コンテンツタイプ | image/jpeg |
| comment_count | コメント数 | 0 |
つまり画像IDをからパスやファイル名が引っ張れる状態になるという訳です。wordpressの画像関係の関数の多くは画像IDをキーにしているものが多い。
また当然ながらメディアアップローダを介さないアップロードはデータベースには登録されないので、wordpressの関数等でハンドリングするのはむずかしくなる。


