You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preview API: different aspect ratio / scale options #31268
Talking with @DeepDiver1975 about the Preview API, the topic of aspect ratio scaling came up. Right now, it appears the y parameter is ignored if the aspect ratio parameter a is set.
This works for wide images, but would return a larger-than-requested image for portrait images.
Landscape Example:
image size: 200 x 100
maximum size: 20 x 20
returned image size: 20 x 10
Portrait Example:
image size: 100 x 200
maximum size: 20 x 20
returned image size: 20 x 40
Ideally, Preview API would allow clients to pick one of these scaling methods:
ignore: ignore aspect ratio
aspect fit: scale image to fit the requested size while maintaining the aspect ratio. The resulting image can be smaller than the requested size.
aspect fill: scale image to fill the requested size while maintaining the aspect ratio, cutting off parts of the image if needed. The resulting image is exactly the requested size.
GitMate.io thinks possibly related issues are #13516 (Previews with aspect ratio need to be properly cached), #16551 (Thumbnail API asks for a preview twice each time), #19548 (Add option to configure preview (and thumbnail, ect.) location), #19958 (Streaming API?), and #6550 ("Enable Previews" config option should default to "false").
Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
🤖 Automated issue analysis by Claude Code review agent.
This 2018 enhancement requested that the Preview API offer selectable aspect-ratio / scale modes (ignore, aspect fit, aspect fill). This capability has since been implemented in current owncloud/core and is exposed through the WebDAV preview API query parameters.
Where it is implemented
The preview engine now supports the requested scaling modes via the mode and a parameters:
lib/private/Preview.php defines the scale modes and the keep-aspect flag:
publicconstMODE_FILL = 'fill';
publicconstMODE_COVER = 'cover';
private$keepAspect = false;
private$mode = self::MODE_FILL;
// ...publicfunctionsetMode($mode) { ... } // "Set whether to cover or fill the specified dimensions"publicfunctionsetKeepAspect($keepAspect) { ... }
lib/private/Files/Node/File.php (getThumbnail(), @since 10.1.0) maps the preview API request parameters onto these options:
apps/dav/lib/Files/PreviewPlugin.php forwards the request query parameters into getThumbnail($queryParams), so these are client-controllable via the preview endpoint.
Mapping to the three modes requested in this issue
ignore (ignore aspect ratio): omit the a parameter → keepAspect = false.
aspect fit (fit within the box, may be smaller than requested): a set with mode=fill (the default) → MODE_FILL.
aspect fill (fill the box exactly, cropping overflow): a set with mode=cover → MODE_COVER.
Behaviour is covered by acceptance tests tests/acceptance/features/apiWebdavPreviews/previewsExactSizing.feature and previewsAutoAdustedSizing.feature.
Since the requested scaling options are now available, this issue appears resolved and is being closed. If a specific behaviour is still missing, please reopen with details.
Activity
[-]Preview API: different aspect ratio scale options[/-][+]Preview API: different aspect ratio / scale options[/+]ownclouders commentedon Apr 25, 2018
GitMate.io thinks possibly related issues are #13516 (Previews with aspect ratio need to be properly cached), #16551 (Thumbnail API asks for a preview twice each time), #19548 (Add option to configure preview (and thumbnail, ect.) location), #19958 (Streaming API?), and #6550 ("Enable Previews" config option should default to "false").
michaelstingl commentedon May 8, 2018
There have been some limitations in the past:
Maybe this can be done right with the new implementation…
ownclouders commentedon Jun 16, 2018
Hey, this issue has been closed because the label
status/STALEis set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.(This is an automated comment from GitMate.io.)
stale commentedon Sep 20, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
DeepDiver1975 commentedon Jun 19, 2026
🤖 Automated issue analysis by Claude Code review agent.
This 2018 enhancement requested that the Preview API offer selectable aspect-ratio / scale modes (ignore, aspect fit, aspect fill). This capability has since been implemented in current
owncloud/coreand is exposed through the WebDAV preview API query parameters.Where it is implemented
The preview engine now supports the requested scaling modes via the
modeandaparameters:lib/private/Preview.phpdefines the scale modes and the keep-aspect flag:lib/private/Files/Node/File.php(getThumbnail(),@since 10.1.0) maps the preview API request parameters onto these options:apps/dav/lib/Files/PreviewPlugin.phpforwards the request query parameters intogetThumbnail($queryParams), so these are client-controllable via the preview endpoint.Mapping to the three modes requested in this issue
aparameter →keepAspect = false.aset withmode=fill(the default) →MODE_FILL.aset withmode=cover→MODE_COVER.Behaviour is covered by acceptance tests
tests/acceptance/features/apiWebdavPreviews/previewsExactSizing.featureandpreviewsAutoAdustedSizing.feature.Since the requested scaling options are now available, this issue appears resolved and is being closed. If a specific behaviour is still missing, please reopen with details.