Link to home
Start Free TrialLog in
Avatar of sachin_dba
sachin_dbaFlag for India

asked on

Wordpress Image database structure

We are building a news website in php which has similar image module as wordpress.

I am looking for a sample database structure for Image module to baseline our tables to make it SEO friendly. I have got following links for wordpress database but it does not have image module.


http://codex.wordpress.org/Database_Description

http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png

Please suggest.
Avatar of darren-w-
darren-w-
Flag of United Kingdom of Great Britain and Northern Ireland image

Images are in wp_posts
Avatar of sachin_dba

ASKER

Which Column you referring?
Global $wpdb;

  $call=  "SELECT " . $wpdb->posts . ".ID, " . $wpdb->posts . ".post_title
                FROM " . $wpdb->posts . "
                WHERE " . $wpdb->posts . ".post_mime_type IN('image/jpeg','image/gif','image/png')
                ORDER BY " . $wpdb->posts . ".post_date DESC";

this would select all the images, hope this helps?
Think meta_value holds link to file:


 this is how you would specify the link to the uploaded file:
$upload_dir = wp_upload_dir();
$upload_dir['baseurl'] . "/" . $line->meta_value
I believe

Meta_key := Meta Keyword
Meta_value := Meta Description

$args['post_mime_type']
(string) A full or partial mime-type, e.g. image, video, video/mp4, which is matched against a post's post_mime_type field

However I am looking for only image tables relationship best suitable for News sites.

So any other suggestions to create image table and relationship will also help.
ASKER CERTIFIED SOLUTION
Avatar of darren-w-
darren-w-
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason C. Levine
However I am looking for only image tables relationship best suitable for News sites.

There's no real magic going on here.  WordPress uses wp_posts_meta to attach images to respective posts but there's no real reason you have to do it the way WordPress does it.  There is no "best" way.  Code what works.
You need to specify how you feel news sites  data differs from normal commercial sites, in respect to SEO ?
thanks