先引用delphi自带的单元 uses EncdDecd; 然后就可以使用下面二个函数了: by 菩提树下的杨过 http://yjmyzz.cnblogs.com/ ///将Bitmap位图转化为base64字符串 function BitmapToString(img:TBitmap):string ; var ms:TMemoryStream; ss:TStringStream; s:string; begin ms := TMemoryStream.Create; …
uses EncdDecd; ///将Bitmap位图转化为base64字符串 function BitmapToString(img:TBitmap):string ; var ms:TMemoryStream; ss:TStringStream; s:string; begin ms := TMemoryStream.Create; img.SaveToStream(ms); ss := TStringStream.Create(''); ms.Position:=0; EncodeStre…
public class ImageToBase64 { //图片转化成base64字符串 public static String GetImageStr(String path,int width,int height) throws IOException {//将图片文件转化为字节数组字符串,并对其进行Base64编码处理 File srcFile = new File(path);//文件上服务器上面的地址 if (!srcFile.exists()) return "";…