From 4258c2e0e7b3f57a5913e2983e316ad2b3e079a5 Mon Sep 17 00:00:00 2001 From: Jelmer Snoeck Date: Mon, 24 Aug 2015 22:39:45 +0100 Subject: Use `GetImageInfo` to see if the image is already registered. --- contrib/fhttp/fhttp.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib/fhttp/fhttp.go') diff --git a/contrib/fhttp/fhttp.go b/contrib/fhttp/fhttp.go index 119e30e..cf13b25 100644 --- a/contrib/fhttp/fhttp.go +++ b/contrib/fhttp/fhttp.go @@ -9,6 +9,12 @@ import ( // provided URL and adding it to the PDF but not adding it to the page. Use // Image() with the same URL to add the image to the page. func RegisterRemoteImage(f *gofpdf.Fpdf, urlStr, tp string) (info *gofpdf.ImageInfoType) { + info = f.GetImageInfo(urlStr) + + if info != nil { + return + } + resp, err := http.Get(urlStr) if err != nil { -- cgit v1.2.1-24-ge1ad