html - 当从我的数据库中导入图像并在图库中输出时,它们会变得模糊吗?
问题描述
我在 php 中有一个简单的图片上传功能。它获取图像并将其作为 blob 上传到数据库。当我将图像调用到画廊时,它变得模糊。有没有办法解决这个问题,我听说有人使用 GD 等。我的代码在下面,用于上传和调用。
画廊.php
<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:1300px;height:500px;overflow:hidden;">
<?php
$result = mysqli_query($connection, "SELECT * FROM tbl_images");
while($row = mysqli_fetch_array($result))
{
?>
<div>
<?php echo'<img width="100%" height:"100%" class="img-fluid" src="data:image/jpg;base64,' . base64_encode($row['name']) . '" />' ?>
</div>
<?php } ?>
上传文件.php
<?php
if(isset($_POST["insert"]))
{
$file = addslashes(file_get_contents($_FILES["image"]["tmp_name"]));
$query = "INSERT INTO tbl_images(name) VALUES ('$file')";
if(mysqli_query($connection, $query))
{
echo '<script>alert("Image Inserted into Database")</script>';
}
}
?>
解决方案
尝试将image-rendering: pixelated
CSS 样式添加到您的img
元素。
推荐阅读
- objective-c - 在没有实现的情况下使用扩展的 NSData 方法
- html - CSS设置关于类选择器的背景图像
- vb.net - 如何 String.Join 一个 String()
- java - Android Wear 打包 - 安装失败
- javascript - VueJs 自定义货币掩码
- ruby-on-rails - ROR - Phusion Passenger 应用程序服务器在启动您的 Web 应用程序时遇到错误
- java - 在新部署的war文件中自动实例化一个类
- python - 使用 jinja 和烧瓶的范围数据库的树形显示
- android - 如何使用 dp 移动按钮?
- reactjs - 如何将borderTop添加到React Material UI Table?