douweiluo0600 2014-06-16 18:28
浏览 24
已采纳

动态网页:将图像存储在单独的表/数据库中?

I just started to use dynamic instead of static webpages so I store everything in my database now. The thing is that I don't really know what's the best way to save my images within the database.

I decided to store the image file paths instead of the images itself in a database. But should I save the urls (up to 50 images per article so that means 50 possible urls) in the same table or should I create another one just for these images? What's the best way to do this?

Related question: Do I need a seperate column for each image? In other words, do I have to create 50 columns for each possible image per news article?

  • 写回答

1条回答 默认 最新

  • donglei1973 2014-06-16 18:34
    关注

    You would create another table with two columns not 50. You can have several rows per page.

    pageref | imagepath
    --------+------------
    home    | image01.jpg
    home    | image02.jpg
    home    | image24.jpg
    home    | image65.jpg
    about   | image03.jpg
    about   | image04.jpg
    

    I say two columns, you might want to store the order in which they appear, the datetime they were uploaded, their dimensions etc.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么