Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/DMarby/picsum-photos
/ functions
Functions
185 in github.com/DMarby/picsum-photos
⨍
Functions
185
◇
Types & classes
37
↓ 40 callers
Method
Run
Run starts the queue and blocks until it's shut down
internal/queue/queue.go:45
↓ 35 callers
Method
Get
(ctx context.Context, id string)
internal/storage/storage.go:10
↓ 31 callers
Method
Set
(ctx context.Context, key string, data []byte)
internal/cache/cache.go:14
↓ 16 callers
Function
InternalServerError
InternalServerError is a convenience function for returning an internal server error
internal/handler/handler.go:15
↓ 12 callers
Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
internal/handler/handler.go:43
↓ 10 callers
Function
createFixture
(router http.Handler, hmac *hmac.HMAC, URL string, fixtureName string, extension string)
internal/imageapi/api_test.go:243
↓ 10 callers
Method
logError
Utility methods for logging
internal/api/api.go:33
↓ 10 callers
Function
resizeImage
(t *testing.T, imageBuffer []byte)
internal/vips/vips_test.go:221
↓ 9 callers
Function
New
New creates a new logger
internal/logger/logger.go:18
↓ 9 callers
Function
SaveToJpegBuffer
SaveToJpegBuffer saves an image as JPEG to a buffer
internal/vips/vips.go:120
↓ 9 callers
Function
SaveToWebPBuffer
SaveToWebPBuffer saves an image as WebP to a buffer
internal/vips/vips.go:140
↓ 8 callers
Function
BadRequest
BadRequest is a convenience function for returning a bad request error
internal/handler/handler.go:23
↓ 8 callers
Function
ResizeImage
ResizeImage loads an image from a buffer and resizes it.
internal/vips/vips.go:97
↓ 8 callers
Method
Start
(ctx context.Context, spanName string, opts ...trace.SpanStartOption)
internal/tracing/tracing.go:58
↓ 8 callers
Function
marshalJson
(v interface{})
internal/api/api_test.go:460
↓ 8 callers
Function
readFixture
(fixtureName string, extension string)
internal/imageapi/api_test.go:189
↓ 7 callers
Function
fixturePath
(fixtureName string, extension string)
internal/vips/vips_test.go:236
↓ 6 callers
Function
Blur
Blur applies gaussian blur to an image
internal/vips/vips.go:175
↓ 6 callers
Function
GetParams
GetParams parses and returns all the path and query parameters
internal/params/params.go:31
↓ 6 callers
Function
Grayscale
Grayscale converts an image to grayscale
internal/vips/vips.go:160
↓ 6 callers
Method
Shutdown
()
internal/cache/cache.go:15
↓ 6 callers
Function
catchVipsError
catchVipsError returns the vips error buffer as an error
internal/vips/vips.go:87
↓ 6 callers
Function
fullTest
(processor *vips.Processor, buf []byte, format image.OutputFormat)
internal/image/vips/vips_test.go:135
↓ 6 callers
Function
readFixture
(fixtureName string, extension string)
internal/vips/vips_test.go:232
↓ 5 callers
Method
Process
Process adds a job to the queue, waits for it to process, and returns the result
internal/queue/queue.go:87
↓ 5 callers
Method
Router
Router returns a http router
internal/api/api.go:38
↓ 5 callers
Function
Tracer
(log *logger.Logger)
internal/tracing/test/tracing.go:11
↓ 5 callers
Method
validateAndRedirect
(w http.ResponseWriter, r *http.Request, p *params.Params, image *database.Image, cacheable bool)
internal/api/image.go:109
↓ 4 callers
Method
Create
Create creates a HMAC based on the parameter values, encoded as urlsafe base64
internal/hmac/hmac.go:15
↓ 4 callers
Method
GetRandom
(ctx context.Context)
internal/database/database.go:20
↓ 4 callers
Function
HMAC
HMAC generates and appends an HMAC to a URL path + query params
internal/params/hmac.go:11
↓ 4 callers
Function
New
New returns a new Provider instance
internal/storage/file/file.go:19
↓ 4 callers
Function
NewCache
NewCache instantiates a new cache
internal/image/cache.go:15
↓ 4 callers
Function
NewEmptyImage
NewEmptyImage returns an empty image object
internal/vips/vips.go:204
↓ 4 callers
Function
NewTask
NewTask creates a new image processing task
internal/image/task.go:26
↓ 4 callers
Method
ProcessImage
(ctx context.Context, task *Task)
internal/image/image.go:7
↓ 4 callers
Method
Router
Router returns a http router
internal/imageapi/api.go:63
↓ 4 callers
Function
UnrefImage
UnrefImage unrefs an image object
internal/vips/vips.go:197
↓ 4 callers
Method
getImage
(r *http.Request, imageID string)
internal/api/image.go:81
↓ 4 callers
Function
serveFile
Serve a static file
internal/api/api.go:135
↓ 4 callers
Function
setupQueue
(f func(ctx context.Context, data interface{}) (interface{}, error))
internal/queue/queue_test.go:11
↓ 3 callers
Function
BuildQuery
Utilities for building a URL with query params BuildQuery builds a query parameter string for the given values It differs from the stdlib url.Values.E
internal/params/query.go:14
↓ 3 callers
Method
Len
Len returns the current number of jobs waiting in the queue buffer
internal/queue/queue.go:82
↓ 3 callers
Method
List
(ctx context.Context, offset, limit int)
internal/database/database.go:23
↓ 3 callers
Method
Match
(r *http.Request)
internal/handler/route_matcher.go:11
↓ 3 callers
Function
New
New returns a new Provider instance
internal/cache/memory/memory.go:17
↓ 3 callers
Function
New
New returns a new Provider instance
internal/database/file/file.go:26
↓ 3 callers
Function
Recovery
Recovery is a handler for handling panics
internal/handler/recovery.go:12
↓ 3 callers
Method
Run
Run starts the health checker
internal/health/health.go:37
↓ 3 callers
Function
Shutdown
Shutdown libvips
internal/vips/vips.go:77
↓ 3 callers
Function
TraceInfo
(ctx context.Context)
internal/tracing/tracing.go:68
↓ 3 callers
Method
Validate
Validate validates that the parameter values matches a given HMAC
internal/hmac/hmac.go:27
↓ 3 callers
Method
getListImage
(image database.Image)
internal/api/list.go:152
↓ 3 callers
Function
intParam
intParam tries to get a param and convert it to an Integer
internal/params/params.go:81
↓ 3 callers
Method
sendImage
sendImage writes the processed image to the response with appropriate headers
internal/imageapi/image.go:123
↓ 3 callers
Function
setup
()
internal/image/vips/vips_test.go:105
↓ 2 callers
Method
Blur
Blur applies gaussian blur to the image
internal/image/task.go:37
↓ 2 callers
Method
GetRandomWithSeed
(ctx context.Context, seed int64)
internal/database/database.go:21
↓ 2 callers
Method
Grayscale
Grayscale turns the image into grayscale
internal/image/task.go:44
↓ 2 callers
Function
Initialize
Initialize libvips if it's not already started
internal/vips/vips.go:29
↓ 2 callers
Method
ListAll
(ctx context.Context)
internal/database/database.go:22
↓ 2 callers
Function
LogFields
LogFields logs the given keys and values for a request
internal/handler/logger.go:58
↓ 2 callers
Function
Logger
Logger is a handler that logs requests using Zap
internal/handler/logger.go:14
↓ 2 callers
Function
Metrics
Metrics is a handler that collects performance metrics
internal/handler/metrics.go:66
↓ 2 callers
Function
New
New initializes a new processor instance
internal/image/vips/vips.go:29
↓ 2 callers
Function
New
New creates a new Queue with the specified amount of workers
internal/queue/queue.go:33
↓ 2 callers
Function
NewHTTPErrorLog
(logger *Logger)
internal/logger/logger.go:68
↓ 2 callers
Function
Serve
Serve starts an http server for metrics and healthchecks
internal/metrics/metrics.go:14
↓ 2 callers
Function
SetUserComment
SetUserComment sets the UserComment field in the exif metadata for an image
internal/vips/vips.go:190
↓ 2 callers
Method
Status
Status returns the status of the health checks
internal/health/health.go:55
↓ 2 callers
Function
Tracer
Tracer is a handler that adds tracing for handlers
internal/handler/tracing.go:12
↓ 2 callers
Method
Write
(p []byte)
internal/logger/logger.go:56
↓ 2 callers
Function
addQueryParam
addQueryParam adds a query parameter to a byte buffer
internal/params/query.go:38
↓ 2 callers
Function
fileHeaders
Set headers for static file handlers
internal/api/api.go:127
↓ 2 callers
Function
fixturePath
(fixtureName string, extension string)
internal/imageapi/api_test.go:254
↓ 2 callers
Method
getImageFromSeed
(r *http.Request, imageSeed string)
internal/api/image.go:95
↓ 2 callers
Method
logError
Utility methods for logging
internal/imageapi/api.go:58
↓ 2 callers
Method
runCheck
()
internal/health/health.go:62
↓ 2 callers
Function
setup
(t *testing.T)
internal/vips/vips_test.go:204
↓ 2 callers
Function
setup
(t *testing.T, ctx context.Context)
internal/imageapi/api_test.go:221
↓ 2 callers
Function
updateButton
(id, page_url)
internal/web/embed/assets/js/images.js:72
↓ 1 callers
Method
Get
Get returns an object from the cache if it exists, otherwise it loads it into the cache and returns it
internal/cache/cache.go:30
↓ 1 callers
Function
Health
Health is a handler for health check status
internal/handler/health.go:11
↓ 1 callers
Function
ServiceUnavailable
ServiceUnavailable is a convenience function for returning a service unavailable error
internal/handler/handler.go:31
↓ 1 callers
Function
ValidateHMAC
ValidateHMAC validates the URL path/query params, given an hmac in a query parameter named hmac
internal/params/hmac.go:22
↓ 1 callers
Method
blur
blur applies gaussian blur to an image
internal/image/vips/image.go:37
↓ 1 callers
Function
buildCacheKey
buildCacheKey creates a unique key for request coalescing based on image parameters
internal/imageapi/image.go:155
↓ 1 callers
Function
buildFilename
(imageID string, p *params.Params)
internal/imageapi/image.go:169
↓ 1 callers
Method
check
(ctx context.Context, channel chan Status)
internal/health/health.go:106
↓ 1 callers
Function
getContentType
(extension string)
internal/imageapi/image.go:145
↓ 1 callers
Function
getFileExtension
getFileExtension gets the file extension (if present) from the path params, and validates it
internal/params/params.go:93
↓ 1 callers
Method
getImage
(id string)
internal/database/file/file.go:56
↓ 1 callers
Function
getImageDimensions
(p *params.Params, databaseImage *database.Image)
internal/api/params.go:41
↓ 1 callers
Function
getLimit
(r *http.Request)
internal/api/list.go:115
↓ 1 callers
Method
getLinkHeader
(page, limit int, end bool)
internal/api/list.go:137
↓ 1 callers
Function
getOutputFormat
(extension string)
internal/imageapi/image.go:136
↓ 1 callers
Function
getPage
(r *http.Request)
internal/api/list.go:128
↓ 1 callers
Function
getQueryParams
getQueryParams returns whether the grayscale and blur queryparams are present
internal/params/params.go:112
↓ 1 callers
Function
getSize
getSize gets the image size from the size or the width/height path params, and validates it
internal/params/params.go:60
↓ 1 callers
Method
grayscale
grayscale turns an image into grayscale
internal/image/vips/image.go:25
next →
1–100 of 185, ranked by callers