gpt4 book ai didi

php - 调整图像大小而不实际更改文件夹中的图像

转载 作者:太空宇宙 更新时间:2023-11-04 03:48:55 25 4
gpt4 key购买 nike

所以我正在使用自动完成功能。我用它来显示留给搜索结果的图像。显示的图像来自产品 表,该图像约为 400x400 像素。但是,在自动完成中,不可能显示该图像。假设我需要一张 50x50 像素的图像,我该如何制作重新调整图像大小的函数(只是为了显示)而实际图像仍然是 400x400 像素?

这是我的产品表:-

productid         productname  price  image
autoincrement somename 100 ../productimages/someimage.extension

现在这个image在php中可以作为$result->image使用。我不知道如何开始。欢迎提出任何建议。

最佳答案

保存临时图像等会很麻烦。为什么不使用所需的宽度在 HTML 中显示它呢?

<img src="someimage.extension" class="thumbnail"/>
<style>
.thumbnail {
width: 50px;
}
</style>

关于php - 调整图像大小而不实际更改文件夹中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23687800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com