任何人都知道如何在mysql中存储图像并使用angular和php显示回来?

时间:2017-05-02 11:14:14

标签: php mysql image angular

我创建了一个网页来显示图片,主题和详细信息。刚才我有一个静态的html页面,这只是一个我没有实现任何东西的页面。

<section class="section-02">
        <div class="container">
    <h3>
            <div class="heading-large">Current Best</div>
          </h3>
    <div class="row">
            <div class="col-md-4">
        <div class="card"> <img class="img-fluid" src="img/media-1.jpg" alt="">
                <div class="card-block">
            <div class="news-title"><a href="#">
              <h2 class=" title-small">An Alternative Form of Mental Health Care Gains a Foothold</h2>
              </a></div>
            <p class="card-text"><small class="text-time"><em>3 mins ago</em></small></p>
          </div>
              </div>
        <ul class="news-listing">
                <li><a href="#">Key Republicans sign letter warning against candidate</a></li>
                <li><a href="#">Obamacare Appears to Be Making People Healthier</a></li>
                <li><a href="#">Syria war: Why the battle for Aleppo matters</a></li>
                <li><a href="#">‘S.N.L.’ to Lose Two Longtime Cast Members</a></li>
              </ul>
      </div>
            <div class="col-md-4">
        <div class="card"> <img class="img-fluid" src="img/media-2.jpg" alt="">
                <div class="card-block">
            <div class="news-title"><a href="#">
              <h2 class=" title-small">Delta passengers got pizza delivered to the plane</h2>
              </a></div>
            <p class="card-text"><small class="text-time"><em>3 mins ago</em></small></p>
          </div>
              </div>
        <ul class="news-listing">
                <li><a href="#">Syria war: Why the battle for Aleppo matters</a></li>
                <li><a href="#">Key Republicans sign letter warning against candidate</a></li>
                <li><a href="#">Obamacare Appears to Be Making People Healthier</a></li>
                <li><a href="#">‘S.N.L.’ to Lose Two Longtime Cast Members</a></li>
              </ul>
      </div>
            <div class="col-md-4">
        <div class="card"> <img class="img-fluid" src="img/media-3.jpg" alt="">
                <div class="card-block">
            <div class="news-title"><a href="#">
              <h2 class=" title-small">Minorities Suffer From Unequal Pain Treatment</h2>
              </a></div>
            <p class="card-text"><small class="text-time"><em>3 mins ago</em></small></p>
          </div>
              </div>
        <ul class="news-listing">
                <li><a href="#">‘S.N.L.’ to Lose Two Longtime Cast Members</a></li>
                <li><a href="#">Key Republicans sign letter warning against candidate</a></li>
                <li><a href="#">Obamacare Appears to Be Making People Healthier</a></li>
                <li><a href="#">Syria war: Why the battle for Aleppo matters</a></li>
              </ul>
      </div>
          </div>
  </div>
      </section>

现在我想使用angular和php

将其存储在mysql数据库中

1 个答案:

答案 0 :(得分:1)

虽然在技术上可以将图像存储在BLOB类型中,但我完全不鼓励你这样做,而是使用基于can的文件系统,如S3或服务器的本地文件系统。只需在DB上存储图像的URI。

在数据库中存储BLOBS会使速度变慢,备份将花费更长时间,并且必须优化查询以避免检索BLOB。如果您有数千名用户,那么简单的SELECT * FROM users;可以杀死您的数据库。