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

Method initialLoadImage

processing/processing.go:148–162  ·  view source on GitHub ↗

initialLoadImage loads a single page/frame of the image. If the image format supports thumbnails and thumbnail loading is enforced, it tries to load the thumbnail first.

(
	img *vips.Image,
	imgdata imagedata.ImageData,
	enforceThumbnail bool,
)

Source from the content-addressed store, hash-verified

146// If the image format supports thumbnails and thumbnail loading is enforced,
147// it tries to load the thumbnail first.
148func (p *Processor) initialLoadImage(
149 img *vips.Image,
150 imgdata imagedata.ImageData,
151 enforceThumbnail bool,
152) (bool, error) {
153 if enforceThumbnail && imgdata.Format().SupportsThumbnail() {
154 if err := img.LoadThumbnail(imgdata); err == nil {
155 return true, nil
156 } else {
157 slog.Debug(fmt.Sprintf("Can't load thumbnail: %s", err))
158 }
159 }
160
161 return false, img.Load(imgdata, 1.0, 0, 1)
162}
163
164// reloadImageForProcessing reloads the image for processing.
165// For animated images, it loads all frames up to MaxAnimationFrames.

Callers 1

ProcessImageMethod · 0.95

Calls 4

SupportsThumbnailMethod · 0.80
LoadThumbnailMethod · 0.80
LoadMethod · 0.80
FormatMethod · 0.65

Tested by

no test coverage detected