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

Method skipStandardProcessing

processing/processing.go:253–278  ·  view source on GitHub ↗

skipStandardProcessing skips standard image processing and returns the original image data. SVG images may be sanitized if configured to do so.

(
	img *vips.Image,
	imgdata imagedata.ImageData,
	po ProcessingOptions,
)

Source from the content-addressed store, hash-verified

251//
252// SVG images may be sanitized if configured to do so.
253func (p *Processor) skipStandardProcessing(
254 img *vips.Image,
255 imgdata imagedata.ImageData,
256 po ProcessingOptions,
257) (*Result, error) {
258 // Even if we skip standard processing, we still need to check image dimensions
259 // to not send an image bomb to the client
260 originWidth, originHeight, err := p.checkImageSize(img, imgdata.Format(), po)
261 if err != nil {
262 return nil, err
263 }
264
265 imgdata, err = p.svg.Process(po.Options, imgdata)
266 if err != nil {
267 return nil, err
268 }
269
270 // Return the original image
271 return &Result{
272 OutData: imgdata,
273 OriginWidth: originWidth,
274 OriginHeight: originHeight,
275 ResultWidth: originWidth,
276 ResultHeight: originHeight,
277 }, nil
278}
279
280// determineOutputFormat determines the output image format based on the processing options
281// and image properties.

Callers 1

ProcessImageMethod · 0.95

Calls 3

checkImageSizeMethod · 0.95
ProcessMethod · 0.80
FormatMethod · 0.65

Tested by

no test coverage detected