MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / stripMetadata

Method stripMetadata

processing/strip_metadata.go:106–135  ·  view source on GitHub ↗
(c *Context)

Source from the content-addressed store, hash-verified

104}
105
106func (p *Processor) stripMetadata(c *Context) error {
107 if !c.PO.StripMetadata() {
108 return nil
109 }
110
111 keepCopyright := c.PO.KeepCopyright()
112
113 var ps3Data, xmpData []byte
114
115 if keepCopyright {
116 ps3Data = stripPS3(c.Img)
117 xmpData = stripXMP(c.Img)
118 }
119
120 if err := c.Img.Strip(keepCopyright); err != nil {
121 return err
122 }
123
124 if keepCopyright {
125 if len(ps3Data) > 0 {
126 c.Img.SetBlob("iptc-data", ps3Data)
127 }
128
129 if len(xmpData) > 0 {
130 c.Img.SetBlob("xmp-data", xmpData)
131 }
132 }
133
134 return nil
135}

Callers

nothing calls this directly

Calls 6

stripPS3Function · 0.85
stripXMPFunction · 0.85
StripMetadataMethod · 0.80
KeepCopyrightMethod · 0.80
StripMethod · 0.80
SetBlobMethod · 0.80

Tested by

no test coverage detected