解法很簡單,就是在WebBrowser中設定一個寬與高都100%的圖片
[pascal]
const
cHtmlString = ‘<img src=%s width=100% height=100%>’;
var
UrlOfImage: string;
begin
UrlOfImage := ‘http://www.xxxx.xxx/xxx.jpg’;
WebBrowser1.LoadFromStrings(Format(cHtmlString, [UrlOfImage]), ”);
end;
[/pascal]
標籤: image
WordPress 移除 wp-image-xx Class
WordPress會很討厭的自動加了一個image-xxxx的class,反而圖片會跑不出來。
進入控制台→外觀→佈置主題,然後開啟functions.php。在最後一行加上以下程式碼就行了!
[javascript]
add_filter( ‘wp_calculate_image_srcset_meta’, ‘__return_null’ ); // 2016.02.19 by lin shou shan
[/javascript]
Delphi將Image存入MySQL資料庫
存入
[php]
var astream : Tmemorystream;
begin
AStream := TMemoryStream.Create;
try
Image1.Picture.Graphic.SaveToStream(AStream);
AStream.Position := 0;
if adoquery1.Active then
begin
adoquery1.Edit;
TBlobField(adoquery1.FieldByName(‘File’)).LoadFromStream(AStream);
adoquery1.Post;
end;
finally
AStream.Free;
end;
[/php]
取出
[php]
var
Ms:TStringStream;
jpg1:Tjpegimage;
begin
Ms := TStringStream.Create(”);
jpg1 := Tjpegimage.create;
try
if adoquery1.Active then
begin
TBlobField(adoquery1.FieldByName(‘File’)).SaveToStream(Ms);
Ms.Position := 0;
jpg1.LoadFromStream(ms);
image1.Picture.Bitmap.Assign(jpg1);
end;
finally
ms.Free;
jpg1.Free;
end;
[/php]
注意,如果出現Got a packet bigger than ‘max_allowed_packet’ bytes
在My.ini加上
max_allowed_packet = 10M