Add filename to image information.

This fixes #6.
develop
Icedream 2016-08-08 14:05:55 +02:00
parent 1e3af32706
commit 3faff8264f
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
2 changed files with 16 additions and 12 deletions

View File

@ -67,19 +67,22 @@
({{ . }}) ({{ . }})
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ if index . "Description" }} {{ with index . "Description" }}
{{ excerpt 384 (index . "Description") }} {{ excerpt 384 . }}
{{ else }} {{ end }}
{{ with index . "ImageType" }} {{ end }}
{{ . }} image,
{{ if index . "ImageType" }}
{{ if index . "Title" }}
·
{{ end }}
{{ .ImageType }} image,
{{ if (index . "ImageSize") (index . "Size") }}
{{ with index . "ImageSize" }}
{{ .X }}×{{ .Y }}
{{ end }} {{ end }}
{{ if (index . "ImageSize") (index . "Size") }} {{ with index . "Size" }}
{{ with index . "ImageSize" }} ({{ size . }})
{{ .X }}×{{ .Y }}
{{ end }}
{{ with index . "Size" }}
({{ size . }})
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -133,6 +133,7 @@ func (p *Parser) Parse(u *url.URL, referer *url.URL) (result parsers.ParseResult
"IsUpload": true, "IsUpload": true,
"ImageSize": image.Point{X: m.Width, Y: m.Height}, "ImageSize": image.Point{X: m.Width, Y: m.Height},
"ImageType": strings.ToUpper(imgType), "ImageType": strings.ToUpper(imgType),
"Title": u.Path[strings.LastIndex(u.Path, "/")+1:],
} }
if resp.ContentLength > 0 { if resp.ContentLength > 0 {
info["Size"] = uint64(resp.ContentLength) info["Size"] = uint64(resp.ContentLength)