推荐/标准图像缩略图尺寸
根据我的Web开发经验,每个网站的HTML页面设计可能都有不同的<图像>标签以不同的尺寸显示相同的图像。即:网站的主页可能以 500*500 显示图像,列表页面可能以 200*150 显示图像,网站的其他部分将使用不同的尺寸。正如您所看到的,向用户显示的图像的比例是不同的,因此会导致图像拉伸、像素化和/或其他质量问题。
我目前处理这个问题的方法是使用 jQuery 裁剪工具让用户选择要从中裁剪缩略图的区域。然后使用 imagick 调整裁剪后的图像大小以适合页面设计中的每个位置。然而,尽管我可以强制用户根据预定义的比例裁剪图像,但 HTML 仍将包含图像占位符,其缩略图需要不同的比例。因此,对于每张图像,我将不得不强制用户根据我的网站所需的每种可能的比例裁剪上传的图像。
我认为这不是一个友好的解决方案,你会怎么做?网络有标准/推荐的比例吗?
谢谢
Based on my experience in web development, HTML page designs for every website may have different < img > tags showing the same image in different sizes. i.e: the website's main page might show the image in 500*500, the listing page might show it in 200*150 and other sections of the website will use different sizes. As you can see the ratios of the images to be displayed to the user are different and therefore will cause a problem in having the image stretched, pixelated and/or other quality problems.
How i currently handle this issue is by using a jQuery cropping tool to make the user select the area to crop the thumbnail from. the cropped image is then resized using imagick to fit every position in the page design. However, although i can force the user to crop an image based on a pre-defined ratio, the HTML will still contain image placeholders which require a different ratio for its thumbnail. So for every image, i will have to force the user to crop the uploaded image based on every possible ratio my site requires.
I don't think this is a friendly solution, how would you do it? is there a standard/recommended ratio for the web?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信这里没有绝对的真理。如果您的发布商具有设计意识,他们可能不喜欢任意裁剪。 (设计不应该被逻辑所奴役。)
如果图像比例很重要,我建议使用两个不同的图像。如果没有,请裁剪/微移或更改布局。
问候,
/吨
There¨s no absolute truth here I belive. If your publishers are design aware, they probably don't like arbitrary cropping. (Design shouldn't be enslaved by logic.)
If image-proportions are significant, I'd suggest two diffenent images. If not, crop/nudge or change layout.
regards,
/t
我只需使用 ImageMagick 自动裁剪缩略图即可。通常,裁剪在缩略图上的确切位置并不那么重要,因此自动执行此操作是解决问题的一种简单方法,无需用户参与,同时仍能获得不错的结果。
I would simply crop the thumbnail images automatically using ImageMagick. Usually, it's not that important exactly where the crop is placed on thumbnail images, so doing it automatically is an easy way to solve the problem without involving the user while still getting a decent result.