我能夠從cfldap獲取所需的所有值。 但是當我嘗試更新用戶圖像時,我不知道如何發送二進制圖像屬性的正確值。如何使用cfldap更改用戶圖像?
我試圖讓從CFFILE圖像變量上傳
<cffile action="UPLOAD" filefield="file" destination="c:\inetpub\wwwroot\test" nameconflict="OVERWRITE" result="image" />
使用cfimage與靜態圖像也試過 -
<cfimage action="read" source="c:\inetpub\wwwroot\test\image.png" name="anotherImage">
甚至與
<cffile action="READBINARY" file="c:\inetpub\wwwroot\test\image.png" variable="BinaryImageContent">
但在任何如果我打電話給
<cfldap action="modify"
DN="#results.dn#"
attributes="thumbnailPhoto=#obj.image#"
modifytype="replace"
server="myserver"
username="mydomain\myuser"
password="mypass">
的#results.dn#是DN從我之前得到(一切好上)用戶 我創造了#obj.image#,以便能夠嘗試所有類型的變量
而且嘗試這些PARAMS:
<cfset obj.test1 = BinaryImageContent />
<cfdump var="#imageGetBlob(anotherImage)#" />
<cfdump var="#toString(obj.test1)#" />
順便說一句,我得到它的
一個或多個所需的屬性的錯誤可能丟失或不正確或 你做的不是H ave權限在服務器上執行此操作。
的問題是,我使用的域管理員帳戶來更新
(此錯誤是解決 - 網絡人員沒有給我這個權限...現在我有它)。
現在我使用的是以下幾點:
<cffile action="UPLOAD" filefield="file" destination="c:\inetpub\wwwroot\test" nameconflict="OVERWRITE" result="imagem" />
<cfset filename = "C:\inetpub\wwwroot\test\#imagem.serverFile#">
<cffile action="readbinary" file="#filename#" variable="img">
<cfset imgStr = BinaryEncode(img, "hex")>
<cfset imgStr2 = REReplace(imgStr, "..", "\\\0", "ALL")>
<cfldap
action="modify"
DN="#results.dn#"
attributes="thumbnailPhoto=#imgStr2#"
modifytype="replace"
server="myserver"
username="mydomain\myuser"
password="mypass"
>
,但我得到這個二進制代碼
請告訴我奇怪的是,之前我有一個二進制代碼像-1 -41和現在,沒有什麼類似的...
當我試圖顯示圖片
我得到這個錯誤,因爲它看起來像我發送一個數據到大值爲 嘗試執行修改時發生錯誤:[LDAP:錯誤代碼19 - 00002082:AtrErr:DSID-03151314,# 1:0:00002082:,問題1005(CONSTRAINT_ATT_TYPE),數據0,Att 160023(thumbnailPhoto):len 466635]。 –
參見http://blog.cjwdev.co.uk/2010/11/03/the-thumbnailphoto-attribute-explained/。 「thumbnailPhoto」大小限制爲100 Kb,建議大小爲96 x 96像素。使用CF的照片編輯功能來製作一張真實的縮略圖。同時比較[thumbnailPhoto'上的MSDN](https://msdn.microsoft.com/en-us/library/cc221395.aspx),尤其是'rangeUpper'部分。 – Tomalak
所以,實際上網絡夥計騙我,管理員用戶有權更改ldap帳戶...現在它已經和我沒有收到錯誤,我沒有權限... 無論如何,我收到奇怪的二進制,當我這樣做...將更新我的問題與數據和圖像 –