某些设备上的图像显示发生变化


Image display alters on some devices

我正在使用位于此处的移动应用程序。它有一个名为"应用程序下载"的链接,只能在ios和android上看到。

现在,在我的iPad上查看此页面时,应用程序图像看起来不错,但在我的galaxy s3上查看此页时,应用软件图像看起来不太好。它很有弹性,很薄。

页面通过以下代码显示图像:

<img src="<?php echo $article['app_img']; ?>" class="appimg" border="0" border="0" align="left"
.appimg {border-radius: 30px;
  -moz-border-radius: 30px;
  -webkit-border-radius: 30px;
    width:150px;    
    height:150px;
    position:relative; 
    background-color: transparent; }

但浏览器的显示显然有所不同。

有人能为我提供一个解决方案吗?

此处提供的屏幕截图:

iPad iPhone Android

以上所有3个都查看相同的代码,但在android上单独显示图像。

请帮忙,谢谢。

即使我在xclo.mobi上也遇到过同样的问题。

然后我使网站动态,我的css是基于当前设备的动态。

因此,尝试获取当前设备并相应地在客户端浏览器上加载css内容。

逻辑:如果当前设备==ipad加载css{width:150px}

这是因为浏览器和设备的分辨率。

我希望下面的代码能帮助你更多。

 <?php

/* detect mobile device*/
$ismobile = 0;
$container = $_SERVER['HTTP_USER_AGENT'];
// A list of mobile devices change as you wish
$useragents = array ( 
'Blazer' ,
'Palm' ,
'Handspring' ,
'Nokia' ,
'Kyocera',
'Samsung' ,
'Motorola' ,
'Smartphone', 
'Windows CE' ,
'Blackberry' ,
'WAP' ,
'SonyEricsson',
'PlayStation Portable', 
'LG', 
'MMP',
'OPWV',
'Symbian',
'EPOC',
); 
foreach ( $useragents as $useragents ) { 
if(strstr($container,$useragents)) {
$ismobile = 1;
} 
}
//And then you can load your css 
//eg:==
if($ismobile=1)
echo '.appimg{width:250px;height:250px}';//Change for device as you want
//After your php statements you can load your site content as usual

希望这能帮助您

使用此代码对其进行排序

.appimg {
border-radius: 30px;
  -moz-border-radius: 30px;
  -webkit-border-radius: 30px;
    width:150px;    
    height:150px;
    position:relative; 
    background-color: transparent;
}
@media only screen and (-webkit-device-pixel-ratio:.75){
.appimg { 
 border-radius: 20px;
  -moz-border-radius: 20px;
  -webkit-border-radius: 20px; 
    width:150px;    
    height:350px;
    position:relative;
    background-color: transparent;
}
}

请举手谢谢。