2016-12-06 23 views
1

我能夠從活動目錄檢索縮略圖照片。但是,由於提取圖像的尺寸似乎很小,我無法將其適應於我想要的位置。調整從活動目錄提取的照片的大小

代碼使用:

<img src="data:image/jpeg;base64,<?php echo "".base64_encode($_SESSION['photo']).""; ?>" alt="profile-sample4" class="profile" style="width:130px ;height: 130px;"/>

是否有辦法來調整所提取的圖像?

+0

呃......你在CSS那裏,已經確定了,不是嗎?只需將130px改爲任何你想要的 – Andrew

+0

它不會發生。我在發佈問題之前已經嘗試了內聯css。反正,謝謝。 – jane

+0

也許試着在''標籤上使用HTML屬性'width ='''和'height ='''它的標籤 – Andrew

回答

1

使用這種代碼在這裏:

function myFunction() { 
 
    var input, filter, ol, li, a, i; 
 
    input = document.getElementById("search52"); 
 
    filter = input.value.toUpperCase(); 
 
    ol = document.getElementById("myOL"); 
 
    li = ol.getElementsByTagName("li"); 
 
    divs=li[0].getElementsByClassName("parent-div"); 
 
    for (i = 0; i < divs.length; i++) { 
 
     a = divs[i].getElementsByClassName("name")[0]; 
 
     if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { 
 
      divs[i].style.display = ""; 
 
     } else { 
 
      divs[i].style.display = "none"; 
 
     } 
 
    } 
 
}

1

我猜的東西覆蓋你的CSS,首先使用

class="profile myimg" 

在標籤圖像,然後去掉「」根據安德魯的編輯。事實上,我相信這可能是一個問題,因爲你使用「內部」。

<img src="data:image/jpeg;base64,<?php echo base64_encode($_SESSION['photo']) ?>" alt="profile-sample4" class="profile myimg" />

,這將是你的CSS類:

.myimg{ 
    width: 130px !important; 
    height: 130px !important; 
} 
+0

不起作用。但問題在於,圖像是從活動目錄中提取的,而不是圖像保存在本地。我已經嘗試了你所說的話。無論如何,謝謝。 – jane

+0

@jane我不認爲圖像的來源是你的問題,另一件事是刪除「」你的src「」,這可能是問題。 –

+0

@jane,你的$ _SESSION ['photo']是什麼樣的? –