summaryrefslogtreecommitdiff
path: root/contrib/fhttp
diff options
context:
space:
mode:
authorJelmer Snoeck <jelmer.snoeck@gmail.com>2015-08-24 22:39:45 +0100
committerJelmer Snoeck <jelmer.snoeck@gmail.com>2015-08-24 22:39:45 +0100
commit4258c2e0e7b3f57a5913e2983e316ad2b3e079a5 (patch)
treebb3342e946530e911cdf504e1065c45e968d7462 /contrib/fhttp
parentf08b5786da8646302e9d94fe048cf2d6a6130144 (diff)
Use `GetImageInfo` to see if the image is already registered.
Diffstat (limited to 'contrib/fhttp')
-rw-r--r--contrib/fhttp/fhttp.go6
1 files changed, 6 insertions, 0 deletions
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 {