如何将一组图像保存到BLOB字段以供主题样式表调用

I was wanting to save my site themes to my database but I was wondering if I can just store all the files and information I need in one row. I didn't want to make 100 rows each with image content.

So for example in 1 row I would have

theme_name
theme_date
theme_data
theme_css_data
theme_js_data
theme_images

etc..

I read that it is better to save images/documents with a BLOB to a database as it takes up less space than a physical disk. But will this be a pain when backing up the database?

Which is a commonly used way to save images,word documents, pds, excel that are part of a theme?

you can save the whole theme in one single field, but how are you gonna use it later? if you need just to archive unused theme then you can pack it in database, but if you want to use files you should do 2 tables:

  1. themes with fields:

    • theme_id
    • theme_name
    • theme_date
    • theme_data (if you don't want to query by this data
  2. theme_files

    • theme_file_id
    • theme_id - used to connect the file to a theme
    • theme_file_keyname - you can use this if you want to query certain files regardless of their file name. example - index (could be index.htm or index.html), stars_image (file could be stars.gif or stars.png)
    • theme_file_name (which might contain relative path. Ex: "images/background/top.gif")
    • theme_file_type (or mime type)

in this case it is better to have one row per each file because when you query the database you want to extract one single file you could use it's theme_file_keyname or theme_file_name. You don't always need all files of the theme