[英]Need to display base64 encoded images from sqlite into a flex datagrid
我在 sqlite 數據庫中將縮略圖(編碼為 base64)作為字符串。
我知道如何解碼和顯示圖像,但我想在數據網格中顯示它,所以我必須檢索(沒有 php)圖像,解碼並在數據網格中顯示它。
我想不出如何進行操作(解碼和顯示)以在數據網格中顯示它。
目前我的數據網格看起來像:
<mx:DataGrid id="dg" left="60" right="51" top="200" fontSize="25" allowMultipleSelection="false" visible="false" dataProvider="{dp}"
horizontalCenter="3" verticalScrollPolicy="auto" editable="true" selectionColor="#FFFF00" rollOverColor="haloSilver">
<mx:columns>
<mx:DataGridColumn headerText="Index:" dataField="id" visible="false"/>
<mx:DataGridColumn headerText="Image" dataField="image" width="150"/>
<mx:DataGridColumn headerText="Description" dataField="description" width="150" />
<mx:DataGridColumn headerText="Web Address (URL)" dataField="url" width="250">
<mx:itemEditor>
<fx:Component>
<mx:TextInput restrict="a-zA-Z+\-.0-9@" maxChars="50" />
</fx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
和我的 sql 代碼,如:
sql.text = "SELECT id, image, url, description FROM bookMarks;";
sql.execute();
var result2:SQLResult = sql.getResult();
當前顯示 base64 編碼字符串(如預期)
您將不得不獲取圖像並將其解碼為 ByteArray。 然后您必須獲取 ByteArray 並將其加載到 Bitmap 中。 同時,您必須制作一個包含 BitmapImage(假設 Flex 4)的自定義 ItemRenderer,並使用 bitmap 作為該圖像的源。
您的問題實際上由 2 或 3 個子任務組成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.