我有一个问题取决于imagemagick: 例如,是否可以上传一张尺寸为1200像素高的图片,并根据设备或浏览器的分辨率 - 减少图像的高度 AND 尺寸?
提前致谢
答案 0 :(得分:2)
您可以根据设备或浏览器版本使用条件。假设你想在下面的图像高度之间切换:
然后将此部分输入模板常量:
# for IE6:
[browser = msie] AND [version = 6]
styles.content.imgtext {
maxH = 600
maxHInText = 600
}
# for mobile devices:
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent = *Android*]||[useragent = *OperaMini*]||[useragent = *BlackBerry*]
styles.content.imgtext {
maxH = 320
maxHInText = 320
}
# For all other browsers
[else]
styles.content.imgtext {
maxH = 800
maxHInText = 800
}
[GLOBAL]
模板设置的替代解决方案(如下所述):
# for IE6:
[browser = msie] AND [version = 6]
tt_content.image.20.1.file {
maxH = 600
maxHInText = 600
}
# for mobile devices:
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent = *Android*]||[useragent = *OperaMini*]||[useragent = *BlackBerry*]
tt_content.image.20.1.file {
maxH = 320
maxHInText = 320
}
# For all other browsers
[else]
tt_content.image.20.1.file {
maxH = 800
maxHInText = 800
}
[GLOBAL]
useragent
一起正常使用,请尝试使用扩展程序cwmobileredirect。它提供了非常可靠的移动设备开关。maxW
)工作正常,但设置高度(maxH
)在4.2以下的版本中有些错误。如果出现maxH问题,请使用替代解决方案。