dqx36753 2013-02-28 14:47
浏览 21
已采纳

图像宽度和高度没有按照我指定的大小调整

All, I have the following code to display an image on my page:

$output .= '<div id="bd-flickr">';
    for($i=0; $i<$count_photos; $i++){
        if($xml->channel->item[$i]){
                preg_match( $regx, $xml->channel->item[$i]->description, $matches );
                $img_url = str_replace("_m.jpg", "_z.jpg", $matches[1]);
                $output .= '<div class="bd-flickr-item">';
                $output .= '<a rel="flickr-widget" class="fancybox" title="&lt;a target=&quot;_blank&quot; href=&quot;'.$xml->channel->item[$i]->link.'&quot;&gt;View in Flickr&lt;/a&gt;" href="' . $img_url .'">';
                $output .= '<img src="'.$img_url.'" height="192px" width="192px" alt="'. $xml->channel->item[$i]->title .'" title="'. $xml->channel->item[$i]->title .'">';
                $output .= '</a>';
                $output .= '</div>';
        }
    }
    $output .= '</div><div style="clear:both; float:none"></div>';
    echo $output

I'm trying to specify that I want the image width and height to be 192px X 192px and I thought by specifying it that would be acheived. The images being displayed on different heights though. I do have some CSS that came with the theme and here is the CSS:

#bd-flickr {min-height:270px}

.bd-flickr-item {
    width:20%;  
    height:auto;  
    float:left; 
    margin:0!important;
    padding:0!important
}

.bd-flickr-item img{
    -moz-transition: 0.4s;
    -webkit-transition: 0.4s;
    -o-transition: 0.4s;
    transition: 0.4s;
    width:100%; 
    height:auto; 
    margin:0!important;
    padding:0!important; 
    display:block
}

html .bd-flickr-item img{
    box-shadow:none!important;
    -webkit-box-shadow:none!important;
    -moz-box-shadow:none!important;
    -o-box-shadow:none!important;
}

.bd-flickr-item img:hover{
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
    opacity: 0.5;
}

a.bd-flickr-link {
    background:#000000 url(../img/camera.png) no-repeat center center; 
    display:block
}

Can anyone see why my images wouldn't be 192px X 192px?

Thanks

  • 写回答

3条回答 默认 最新

  • dswqw66280 2013-02-28 14:51
    关注

    See this:

    .bd-flickr-item img{
        -moz-transition: 0.4s;
        -webkit-transition: 0.4s;
        -o-transition: 0.4s;
        transition: 0.4s;
    
        /* Issue here */
        width:100%; 
        height:auto; 
    
        margin:0!important;
        padding:0!important; 
        display:block
    }
    

    The width and height is specified. Just remove them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示