图像调整大小 [英] image resize

查看:88
本文介绍了图像调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图像宽度为213,高度为200时

i回显图像并调整大小

echo"< img src =''公司/ $ present''width =''70''height ='''68''/>" ;;

图像不像213 * 200那样清晰。我可以

在我将其调整为70 * 200之后使图像清晰。

解决方案

present''width =''70''高度='''68''/>" ;;

图像不像213 * 200那样清晰。我可以吗?
使图像清晰我已将其调整为70 * 200。


您好。


当您调整大小时,使用< img>高度和宽度属性,你基本上是将它留给浏览器调整大小。

可以预见的是,Internet Explorer在这方面做得很糟糕,而其他主流浏览器在调整它们方面做得相当不错。


如果要确保图像平滑缩放,可以让PHP调整图像大小。 GD扩展提供 imagecopyresampled 功能,可以很好地调整图像大小。 (请参阅文档以获取有关如何使用它的示例)


请注意,图像处理是一项非常耗费资源的任务,因此如果您经常显示图像已调整大小,您应该将已调整大小的图像保存到服务器的文件系统并从那里进行服务,而不是为每个请求调整大小。


如果我想回显图像我的数据库,

将涉及vaious图像,我怎么能调整它和

也保持调整大小图像像原来一样平滑.i

如果将给我的答案将在我的代码上进行编辑,将会很感激

展开 | 选择 | Wrap | 行号

i have an image which width is 213 and height is 200 when
i echo the image and i resize it
echo "<img src=''company/$present'' width=''70'' height=''68''/>";
the image was not as clear as when it was 213 * 200.how can i
make the image clear after i have resize it to 70 * 200.

解决方案

present'' width=''70'' height=''68''/>";
the image was not as clear as when it was 213 * 200.how can i
make the image clear after i have resize it to 70 * 200.


Hi.

When you resize it as you do, with the <img> height and width attributes, you are essentially leaving it up to the browser to resize it.
Predictably, Internet Explorer does a horrible job at this, while the other major browsers do a pretty good job resizing them.

If you want to ensure that the image is scaled smoothly, you can have PHP resize the image. The GD extension offers the imagecopyresampled function, which does an excellent job resizing images. (See the documentation for examples on how to use it)

Note that image processing is a very resource intensive task, so if you frequently display you images resized, you should save the resized image to the server''s file-system and serve it from there, rather then resize it for every request.


what if i want to echo the image from my database, which
will involve vaious image how can i then resize it and
also keep the resize image smooth like the original.i
will appreciate it if the answer that will be given to me will
be edited on my code

Expand|Select|Wrap|Line Numbers


这篇关于图像调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆