Redimensionamento de imagens
O Tinify CDN pode redimensionar suas imagens em tempo real. Em particular, é possível redimensionar imagens para criar versões menores, como miniaturas.
Exemplo
As imagens podem ser redimensionadas usando parâmetros de query string na URL da imagem. O exemplo a seguir reduz a imagem panda.png para 100 pixels de largura, ajustando a altura proporcionalmente.
https://xxxxxxxx.tinifycdn.com/panda.png?resize.width=100
Vários parâmetros de query string podem ser combinados:
https://xxxxxxxx.tinifycdn.com/panda.png?resize.width=100&resize.height=50&resize.method=fit
Opções de redimensionamento
O parâmetro
resize.methoddescreve como sua imagem será redimensionada. Os seguintes métodos estão disponíveis.
resize.method=scale- Scales the image down proportionally. You must provide either a target
resize.widthor a targetresize.heightparameter, but not both. The scaled image will have exactly the provided width or height. resize.method=fit- Scales the image down proportionally so that it fits within the given dimensions. You must provide both a
resize.widthandresize.heightparameter. The scaled image will not exceed either of these dimensions. resize.method=cover- Scales the image proportionally and crops it if necessary so that the result has exactly the given dimensions. You must provide both a
resize.widthandresize.heightparameter. The parts of the image that are cropped away are determined automatically. An intelligent algorithm determines the most important areas of your image. resize.method=thumb- A more advanced implementation of cover that also detects cut-out images with plain backgrounds. The image is scaled down to the
resize.widthandresize.heightyou provide. If an image is detected with a free-standing object it will add more background space where necessary or crop the unimportant parts.
We have guides and video instructions available for many popular platforms (content management systems and web frameworks). More are coming!