简体   繁体   English

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

[英]Anyone know how to store image in mysql and display back using angular and php?

I have created a web page to display image, topic and details. 我创建了一个网页来显示图像,主题和详细信息。 Just now i have a static html page this is just a page i have nothing implemented any thing. 刚才我有一个静态的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>

now i want to store this in mysql database using angular and php 现在我想使用angular和php将其存储在mysql数据库中

Although it's technically possible to store an image in a BLOB type, I totally discourage you to do it and rather use a could-based filesystem such as S3 or the local filesystem of the server. 尽管从技术上讲可以将图像存储为BLOB类型,但我完全不建议您这样做,而应该使用基于罐的文件系统,例如S3或服务器的本地文件系统。 Just store on the DB the URI of the image. 只需将图像的URI存储在DB上即可。

Storing BLOBS in the DB will make it slower, the backups will take much longer and the queries must be optimized to avoid retrieving the BLOB. 在数据库中存储BLOBS将使其变慢,备份将花费更长的时间,并且必须优化查询以避免检索BLOB。 A simple SELECT * FROM users; 一个简单的SELECT * FROM users; can kill your DB if you have thousands of users. 如果您有成千上万的用户,可能会杀死您的数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM