简体   繁体   English

如何从几种尺寸的图像创建缩略图?

[英]How to create a thumbnail from a several sizes of images?

I got a web page in JSP, the page is showing several images which being uploaded from the user in any size, the goal is to show each image as a thumbnail. 我在JSP中有一个网页,该页面显示了几张图像,这些图像是从用户以任何大小上传的,目的是将每张图像显示为缩略图。

Currently I made a style to img tag with: height="20%" width="auto" and it's good enough for medium and large images, but when the image is small it makes it very small. 目前,我为img标签制作了一种样式,其height="20%" width="auto"height="20%" width="auto" ,对于中等大小和较大的图像来说已经足够了,但是当图像很小时,它会变得非常小。

How can I make the images in the same size? 如何制作相同尺寸的图像?

Set the height to an absolute value. height设置为绝对值。 For example: 例如:

<img height="200px" width="auto">

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

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