GithubHelp home page GithubHelp logo

kirby3-webp's Introduction

WebP Plugin for Kirby 3

A snippet and Kirby tag for using WebP images in templates and within textareas. Plugin will convert uploaded files to WebP on the server. This requires having the appropriate extensions installed for IM, GD or whatever you are using. Plugin was tested with GD & cwebp

Installation

Manual

To use this plugin, place all the files in site/plugins/kirby3-webp.

Composer

composer require hashandsalt/kirby3-webp

Commerical Usage

This plugin is free but if you use it in a commercial project please consider to


Usage

Using the Kirby Tag

On a basic level, this is enough:

(webp: yourimage.webp)

This will generate a picture tag with images for the default range of sizes: [1920, 1140, 640, 320].

Will also accept width, height, type, class, imgclass, and alt.

The type allows you to set wether the fall back image is a jpg or a png.

Full example:

(webp: yourimage.webp width: 800 height: 600 type: png class: picturetagclass img: imgtagclass alt: my awesome alt text)

Using the snippet

The tag uses a snippet, which you can use in your templates:

snippet('webp', ['sizes' => [1920, 1140, 640, 320], 'src' => 'yourimage.webp', 'type' => 'png', 'class' => 'picturetagclass', 'width' => 800, 'height' => 600])

If you want to modify the output of the snippet, you can copy it from the plugin into the usual snippet folder and it will get over ridden with your customised version. This is useful if you want to use focusCrop plugin rather then the built in resize().

Options

// Tag Options
'hashandsalt.kirby-webp.range' => [1920, 1140, 640, 320], // Default range of image sizes

// Convert Options
'hashandsalt.kirby-webp.template' => 'images', // file blueprint for converted files
'hashandsalt.kirby-webp.meta' => true,  // all|none|exif|icc|xmp

'hashandsalt.kirby-webp.png.encoding' => 'auto', // auto|lossy|lossless
'hashandsalt.kirby-webp.png.quality'  => 85, // 1 - 100

'hashandsalt.kirby-webp.jpeg.encoding' => 'auto', // auto|1 - 100
'hashandsalt.kirby-webp.jpeg.quality'  => 85, // 1 - 100

Roadmap

The following features will be implemented over time:

  • Field Method.
  • File Method.
  • Convert source image to WebP on the server.

kirby3-webp's People

Contributors

hashandsalt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

paulmorel

kirby3-webp's Issues

None of the converters in the stack are operational

He there,

After uploading an image i get: None of the converters in the stack are operational
It seems the problem that PHP is compiled with GD lib but the WebP Support is missing.
Is there any way around this? I'm trying to get the plugin to work on a shared host.
So unfortunately i have no control over the gd extensions.

thanks!
w

`Call to a member function resize() on null`

I'm getting following error when using (webp: test.webp)

Call to a member function resize() on null
\site\plugins\kirby3-webp-master\snippets\webp.php:30

Kirby 4.0.0-rc.4
PHP 8.1.23

`toVariants()` missing ?!

Hey there,
the latest release removed sure a hell of methods, leading to the snippet not working anymore - what happened there?

:)

Missing Class "Stack"

Hey there,
I get an error when using your fantastic lib, and it's fixed when I use WebPConvert\Convert\Converters\Stack; in the main index.php

Cheers!
S1SYPHOS

Add AVIF support

Hey there,
I'd like to propose adding AVIF (next-gen stuff, but its future is looking bright) support, since the pipeline / methods you already have would just have to be cloned. I'm planning to integrate it first in the underlying lib by @rosell-dk or to create something similar. For now, would that be something you're willing to add once I figured it out?

Cheers,
S1SYPHOS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.