duanjia7912 2012-02-13 20:51
浏览 66
已采纳

如何将图像文件存储在站点的后端

I'm building a site, and have just started getting into developing the backend.

The point of my site will be to display images to a visitor. For development purposes, I'd like to test everything first before going live.

I'd like to know what the best way of storing these images is. I've just finished setting up my Wamp server, and added a new db with phpMyAdmin. I found that I can store each image directly in the mySQL database as a BLOB data type. But is this the best way to go?

Thank you!

  • 写回答

4条回答 默认 最新

  • doudaochu1699 2012-02-13 20:54
    关注

    This is most certainly not the way to go. You will then need to keep the blob in memory in PHP before sending it to the browser.

    A better approach would be to store the images as files in the filesystem and just store the filename in your database. that way, you can offload the entire image serving to the web server and never involve PHP in the HTTP requests for the file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应