最近开发的一个系统,需根据用户提交的图片(图片文件以字符流的形式从客户机传到服务器)读出该图片的高和宽,通过下列代码实现了该功能,现在拿出来给大家参考。
……
type
TGIFHeader = packed record
Signature: array[0..2] of Char;
Version: array[0..2] of Char;
ScreenWidth: Word;
ScreenHeight: Word;
PackedFields,
BackgroundColorIndex,
AspectRatio: Byte;
end;
TGIFInfoHeader = TGIFHeader;
……
procedure Ttempphoto.AddMediaRec(out content_no, succed, errno,
errmsg: OleVariant; const PicName, Title, Author, Theme, PublishDate,
KeyWord: WideString; Length: SYSUINT; const Memo: WideString; PicHight,
PicWidth, Color_Pan: SYSUINT; content: OleVariant; PayNo: SYSINT;
const GroupNo: WideString);
file://过程中部分相关的代码
var
p : pwidechar;
bb : string;
tempchar : integer;
mm : SYSUINT;
jpeg: TJPEGImage;
Gif:TGIFInfoHeader;
bmp:TBitmapInfoHeader;
phowidth: integer;
Phoheight: integer;
ss:TStringStream;
fileheader:TBitmapfileheader;
begin
……
p := Tvardata(content).volestr;
setlength(bb,Length);
mm := 1;
while mm<=Length do
begin
tempchar := integer(p[(mm-1) div 2]);
bb[mm]:= chr(tempchar mod 256);
if mm
本文地址:http://com.8s8s.com/it/it6292.htm