Add support for image optimization
まだ誰も着手していません。
評価
調査の方向性
まず Java SDK の構成と、対応する image-optimization helper に関するリンク先の .NET SDK pull request を確認します。この issue のパラメータ仕様を動作のチェックリストとして使用し、サポートされている各変換と無効な入力の各ケースをカバーするテストを追加してから、生成された URL が期待される結果と一致することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Kentico Cloud now supports image optimization. It gives developers the option of transforming images using URL parameters. The goal of this task is to implement a helper class that will make generation of image URLs easy for the developers.
The reference code can be observed in the .NET SDK.
The full specification follows:
Example
Scale
image.jpg?mode=scale&width=300
image.jpg?mode=scale&height=150
image.jpg?mode=fit&height=150&width=300
DPR
image.jpg?mode=scale&width=300&dpr=2.0
Specification
If a developer provides a parameter with invalid value or omits a parameter that is required for desired optimization, the Asset API will either ignore this parameter, or return the original asset without any optimizations.
Also, to keep our sanity, we will transform each image optimization parameter independently from others. Yes, this approach might sometimes produce surprising results. However, both Fastly and imgix are designed to handle a set of parameters that do not make sense and we are not making the situation worse.
Regarding requests to the Asset API, the idea is to go through all parameters, transform the supported ones and get rid of everything else.
To get a grasp of the image optimization You can experiment with two identical images:
rect=x,y,w,h (incompatible with crop)
| - | - |
|---|---|
| x is not float | Nothing |
| x < 0.0 | Nothing |
| y is not float | Nothing |
| y < 0.0 | Nothing |
| w is not float | Nothing |
| w <= 0.0 | Nothing |
| h is not float | Nothing |
| h <= 0.0 | Nothing |
| h <= 0.0 | Nothing |
| otherwise | crop={w},{h},x{x},y{y} |
If the rect parameter is malformed, just ignore it.
fit=crop&crop=focalpoint&fp-x=x&fp-y=y&fp-z=z (incompatible with rect)
| - | - |
|---|---|
| x is not float | set x as 0.5 |
| y is not float | set y as 0.5 |
| z is not float | Nothing |
| z <= 1.0 | Nothing |
| 1 / z < 1.0 | Nothing |
| otherwise | crop={1 / z},{1 / z},offset-x{(x * z - 0.5) / (z - 1)},offset-y{(y * z - 0.5) / (z - 1) * 100} |
Both offset-x and offset-y must be clamped into range from 0 to 100.
imgix supports crop by both rectangle and focal point. Unfortunately, it is not so easy to calculate Fastly parameters. Therefore, let's declare the rect parameter more important. So, if both crop by rectangle and focal point are specified, choose the first.
fm=x
| - | - |
|---|---|
| x = gif | format=gif |
| x = png | format=png |
| x = png8 | format=png8 |
| x = jpg | format=jpg |
| x = pjpg | format=pjpg |
| x = webp | format=webp |
| otherwise | Nothing |
fm=webp&lossless=x
| - | - |
|---|---|
| x = 1 | format=webpll |
| x = true | format=webpll |
| x = 0 | format=webply |
| x = false | format=webply |
| otherwise | format=webp |
q=x
| - | - |
|---|---|
| x is not float | Nothing |
| otherwise | quality={x}\ |
auto=x
| - | - |
|---|---|
| x = format | auto=webp |
| otherwise | Nothing |
Local variables and related functions will be required to transform parameters.
- 主要言語
- Java
- スター
- 17
- フォーク
- 27
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
kontent-ai/java-packages のほかの issue
-
hacktoberfest refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
kontent-ai/java-packages#142 · コメント 1 件 ·
-
hacktoberfest
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
kontent-ai/java-packages#140 · コメント 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
kontent-ai/java-packages#135 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
kontent-ai/java-packages#134 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
kontent-ai/java-packages#128 · コメント 3 件 ·
kontent-ai/java-packages の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openhab/openhab-addons#22512 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/maven-project-info-reports-plugin#704 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/maven-ejb-plugin#261 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/maven-archetype#1086 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信