I am a newbie designing a database and I need a help about picture table.
CREATE TABLE LANGUAGE (
id int(10) unsigned not null auto_increment,
LANGUAGE VARCHAR(45),
IMAGE_id INT(10) UNSIGNED NOT NULL,
// some more
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE PRODUCT(
id int(10) unsigned not null auto_increment,
// some more
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE PRODUCT_IMAGE(
PRODUCT_id INT(10) UNSIGNED NOT NULL,
IMAGE_id INT(10) UNSIGNED NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE CATEGORY(
id int(10) unsigned not null auto_increment,
IMAGE_id INT(10) UNSIGNED NOT NULL,
// some more
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
I want to create a image table but i did not figure out a right way yet.
- one product may have much more that one image
- every category and language have one image
- I want a elastic image table that i can use it in website and apps
- I might need a different sizes of an image
so i designed something like that
CREATE TABLE IMAGE(
id int(10) unsigned not null auto_increment,
extension varchar(5),
file_name varchar(45),
file LONGBLOB,
//some more
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Should i keep some certain sizes of an image I then resize the image in my apps or website?