调整图像大小 [英] Resizing images

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

问题描述

我正在使用PHP的论坛应用程序。在签名字段中,我有$
< img src ='randomimage.png'>< br> bla blah

I'm working on a forum application in PHP. In signature field I have
"<img src='randomimage.png'><br>bla blah"

如果图像大于字段,它会拉伸我的表并看起来很糟糕。如果图像太大,有没有办法重新调整图像尺寸?

If an image is bigger than the field it stretches my tables and looks bad. Is there any way to re size the image if its too big?

抱歉我的英文不好并感谢您的阅读

Sorry for my poor English and thank you for reading

编辑:问题在于它不仅仅是图像。它是图像和文本大文本。

The thing is that it's not only the image. It's the image and the text "the big text".

尊重,Tom

推荐答案

PHP ...



您可以使用gdlibrary重新调整图像大小(请参阅: PHP / GD - 裁剪和调整图像大小),但如果您还不熟悉PHP,这可能会很复杂。

PHP...

You can re-size images with the gdlibrary (See: PHP/GD - Cropping and Resizing Images), but that may be complicated if you're not already pretty familiar with PHP.

存在可以动态调整图像大小的插件(拉伸图像本身)。查看maxSide: http://css-tricks.com/maxside -jquery-plugin-and-how-to /

A plugin exists that can dynamically resize images (stretching the image itself). Check out maxSide: http://css-tricks.com/maxside-jquery-plugin-and-how-to/

A保持签名图像被驯服的快速解决方案是用css限制它们的溢出:

A quick-solution for keeping the signature imaged tamed is to restrict their overflow with css:

<img src="randomimage.png" />

成为

<div class="sigBox"><img src="randomimage.png" /></div>

使用以下CSS:

div.sigBox { overflow:hidden; width:50px; height:50px; }

这会隐藏大图像,而不是让它们扭曲你的内容。

This will hide large images, rather than allowing them to distort your content.

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

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