1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
//copie des images sources, géneration de la page html
//et création des miniatures vers le dossier destination
procedure TFormhtm.BokClick(Sender: TObject);
var i,j,nb:integer;
result,body:TStringList;
imgsrc,thumbsrc:string;
//sColor: string;
//vColor : tColor;
begin
result:=TStringList.Create();
body:=TStringList.Create();
result.Add('<html>');
result.Add('<result>');
result.Add('<style type="text/css">');
result.Add('<!--');
result.Add('.pagetitle {');
result.Add(' font-family: Verdana, Arial, Helvetica, sans-serif;');
result.Add(' font-size: 24pt;');
result.Add(' color: #000000;');
result.Add(' font-weight: bold;');
result.Add('}');
result.Add('.thumbtitle {');
result.Add(' font-family: Verdana, Arial, Helvetica, sans-serif;');
result.Add(' font-size: 10pt;');
result.Add(' color: #000000;');
result.Add('}');
result.Add('.imagetitle {');
result.Add(' font-family: Verdana, Arial, Helvetica, sans-serif;');
result.Add(' font-size: 10pt;');
result.Add(' color: #000000;');
result.Add('}');
result.Add('.navigation {');
result.Add(' font-family: Verdana, Arial, Helvetica, sans-serif;');
result.Add(' font-size: 10pt;');
result.Add(' color: #000000;');
result.Add(' font-weight: bold;');
result.Add('}');
result.Add('-->');
result.Add('</style>');
result.Add('<title>'+edit6.Text+'</title>'); //'+colortostring(colordialog1.color)+'
result.add('</result><body style:"background-color: #'+inttostr(colordialog1.color)+'"><center><span class="pagetitle">'+edit6.Text+'</span><br><br>');
result.Add('<table border="0" cellpadding="5" cellspacing="5">');
ProgressBar1.Max:=NbImage*2;
ProgressBar1.Position:=0;
ProgressBar1.Step:=1;
for i:=1 to NbImage do
begin
imgsrc:=ExtractFileName(GridSource.Cells[3,i]);
//createThumb(srcFile,DestPath:String;size:integer;prefix:String;
//shadow,border:boolean;bsize:integer;bcolor:TColor);
createThumb(GridSource.Cells[3,i],edit4.Text,edit3.text,strtoint(edit1.text),
checkbox4.Checked,checkbox5.Checked,strtoint(edit5.text),
Shape1.Brush.Color);
CopyFile(Pchar(GridSource.Cells[3,i]),Pchar(edit4.text+'\'
+ExtractFileName(GridSource.Cells[3,i])),false);
thumbsrc:=ExtractFileName(edit3.text+imgsrc);
ProgressBar1.StepIt;
body.add('<td align="center"><a href="'+imgsrc+'"><img src="'+thumbsrc
+'" border="0"></a></td>');
end;
//Nombre de colonnes de base = 4
i:=0;
nb:= body.Count;
while(i<=nb-6) do
begin
result.Add('<tr>');
result.Add(body.Strings[i]);
result.Add(body.Strings[i+1]);
result.Add(body.Strings[i+2]);
result.Add(body.Strings[i+3]); //De base = 4
result.Add(body.Strings[i+4]);
result.Add(body.Strings[i+5]);
result.Add('</tr>');
i:=i+6;
ProgressBar1.StepIt;
end;
result.Add('<tr>');
for j:=i to nb-1 do
begin
result.Add(body.Strings[j]);
ProgressBar1.StepIt;
end;
result.Add('</tr>');
result.Add('</body></html>');
result.SaveToFile(edit4.text+'\index.htm');
ProgressBar1.Position:=ProgressBar1.Max;
FrmPrinc.w3.Play;
//ProgressBar1.Position:=0;
end; |
Partager