@@ -151,7 +151,7 @@ func (f *File) AddPicture(sheet, cell, name string, opts *GraphicOptions) error
151151 if _ , err = os .Stat (name ); os .IsNotExist (err ) {
152152 return err
153153 }
154- ext , ok := supportedImageTypes [path .Ext (name )]
154+ ext , ok := supportedImageTypes [strings . ToLower ( path .Ext (name ) )]
155155 if ! ok {
156156 return ErrImgExt
157157 }
@@ -202,7 +202,7 @@ func (f *File) AddPicture(sheet, cell, name string, opts *GraphicOptions) error
202202func (f * File ) AddPictureFromBytes (sheet , cell string , pic * Picture ) error {
203203 var drawingHyperlinkRID int
204204 var hyperlinkType string
205- ext , ok := supportedImageTypes [pic .Extension ]
205+ ext , ok := supportedImageTypes [strings . ToLower ( pic .Extension ) ]
206206 if ! ok {
207207 return ErrImgExt
208208 }
@@ -659,7 +659,7 @@ func (f *File) getPicture(row, col int, drawingXML, drawingRelationships string)
659659 if err = nil ; deTwoCellAnchor .From != nil && deTwoCellAnchor .Pic != nil {
660660 if deTwoCellAnchor .From .Col == col && deTwoCellAnchor .From .Row == row {
661661 drawRel = f .getDrawingRelationships (drawingRelationships , deTwoCellAnchor .Pic .BlipFill .Blip .Embed )
662- if _ , ok = supportedImageTypes [filepath .Ext (drawRel .Target )]; ok {
662+ if _ , ok = supportedImageTypes [strings . ToLower ( filepath .Ext (drawRel .Target ) )]; ok {
663663 pic := Picture {Extension : filepath .Ext (drawRel .Target ), Format : & GraphicOptions {}}
664664 if buffer , _ := f .Pkg .Load (strings .ReplaceAll (drawRel .Target , ".." , "xl" )); buffer != nil {
665665 pic .File = buffer .([]byte )
@@ -690,7 +690,7 @@ func (f *File) getPicturesFromWsDr(row, col int, drawingRelationships string, ws
690690 if anchor .From .Col == col && anchor .From .Row == row {
691691 if drawRel = f .getDrawingRelationships (drawingRelationships ,
692692 anchor .Pic .BlipFill .Blip .Embed ); drawRel != nil {
693- if _ , ok = supportedImageTypes [filepath .Ext (drawRel .Target )]; ok {
693+ if _ , ok = supportedImageTypes [strings . ToLower ( filepath .Ext (drawRel .Target ) )]; ok {
694694 pic := Picture {Extension : filepath .Ext (drawRel .Target ), Format : & GraphicOptions {}}
695695 if buffer , _ := f .Pkg .Load (strings .ReplaceAll (drawRel .Target , ".." , "xl" )); buffer != nil {
696696 pic .File = buffer .([]byte )
0 commit comments