mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
experiental ?mode=thumb to append to jpg files
This commit is contained in:
parent
db2ad83c77
commit
21349e5c04
26
main.pas
26
main.pas
@ -5339,6 +5339,29 @@ var
|
|||||||
runEventScript('login')
|
runEventScript('login')
|
||||||
end; //urlAuth
|
end; //urlAuth
|
||||||
|
|
||||||
|
function thumb():Boolean;
|
||||||
|
var
|
||||||
|
b: rawbytestring;
|
||||||
|
s, e: integer;
|
||||||
|
begin
|
||||||
|
if mode <> 'thumb' then
|
||||||
|
exit(FALSE);
|
||||||
|
result:=TRUE;
|
||||||
|
b:=loadFile(f.resource, 0, 96*KILO);
|
||||||
|
s:= pos(rawbytestring(#$FF#$D8#$FF), b, 2);
|
||||||
|
if s > 0 then
|
||||||
|
e:=pos(rawbytestring(#$FF#$D9), b, s);
|
||||||
|
if (s=0) or (e=0) then
|
||||||
|
begin
|
||||||
|
data.conn.reply.mode:=HRM_NOT_FOUND;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
conn.reply.contentType:='image/jpeg';
|
||||||
|
conn.reply.mode:=HRM_REPLY;
|
||||||
|
conn.reply.bodyMode:=RBM_STRING;
|
||||||
|
conn.reply.body:=Copy(b, s, e-s+2);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
b: boolean;
|
b: boolean;
|
||||||
s: string;
|
s: string;
|
||||||
@ -5698,6 +5721,9 @@ var
|
|||||||
|
|
||||||
if notModified(conn, f) then // calling notModified before limitsExceededOnDownload makes possible for [download] to manipualate headers set here
|
if notModified(conn, f) then // calling notModified before limitsExceededOnDownload makes possible for [download] to manipualate headers set here
|
||||||
exit;
|
exit;
|
||||||
|
if thumb() then
|
||||||
|
Exit;
|
||||||
|
|
||||||
data.countAsDownload:=f.shouldCountAsDownload();
|
data.countAsDownload:=f.shouldCountAsDownload();
|
||||||
if data.countAsDownload and limitsExceededOnDownload() then
|
if data.countAsDownload and limitsExceededOnDownload() then
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user