summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdf.go13
-rw-r--r--fpdf_test.go4
2 files changed, 6 insertions, 11 deletions
diff --git a/fpdf.go b/fpdf.go
index 470a81b..d77fd4b 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -2359,15 +2359,10 @@ func (f *Fpdf) RegisterImage(fileStr, tp string) (info *ImageInfoType) {
}
// GetImageInfo returns information about the registered image specified by
-// imageStr. If the image has not been registered, an empty structure followed
-// by false is returned. The internal error is not modified by this method.
-func (f *Fpdf) GetImageInfo(imageStr string) (info ImageInfoType, ok bool) {
- var infoPtr *ImageInfoType
- infoPtr, ok = f.images[imageStr]
- if ok {
- info = *infoPtr
- }
- return
+// imageStr. If the image has not been registered, nil is returned. The
+// internal error is not modified by this method.
+func (f *Fpdf) GetImageInfo(imageStr string) (info *ImageInfoType) {
+ return f.images[imageStr]
}
// GetXY returns the abscissa and ordinate of the current position.
diff --git a/fpdf_test.go b/fpdf_test.go
index b556713..71aa0d2 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -1086,8 +1086,8 @@ func ExampleFpdf_RegisterImage() {
// Test the image information retrieval method
infoShow := func(imageStr string) {
imageStr = imageFile(imageStr)
- info, ok := pdf.GetImageInfo(imageStr)
- if ok {
+ info := pdf.GetImageInfo(imageStr)
+ if info != nil {
if info.Width() > 0.0 {
fmt.Printf("Image %s is registered\n", imageStr)
} else {