import { default } from "https://deno.land/x/fresh_images@v0.3.0/src/transformers/resize.ts";
Resize an image to a given width and/or height.
Examples
Example 1
Example 1
import { defineConfig } from "$fresh/server.ts";
import ImagesPlugin from "fresh_images/mod.ts";
import { resize } from "fresh_images/transformer.ts";
export default defineConfig({
plugins: [
ImagesPlugin({
publicPath: "/img",
transformers: { resize },
}),
]
});
Example 2
Example 2
<img src="/img/meow.jpg?fn=resize&rw=100" alt="Resized to 100px wide" />
<img src="/img/meow.jpg?fn=resize&resizeWidth=100" alt="Resized to 100px wide" />
<img src="/img/meow.jpg?fn=resize&rh=100" alt="Resized to 100px tall" />
<img src="/img/meow.jpg?fn=resize&resizeHeight=100" alt="Resized to 100px tall" />
<img src="/img/meow.jpg?fn=resize&rw=100&h=100" alt="Resized to 100px by 100px" />
<img src="/img/meow.jpg?fn=resize&resizeWidth=100&resizeHeight=100" alt="Resized to 100px by 100px" />