Giter Club home page Giter Club logo

imageblurhash's Introduction

ImageBlurhash

ImageBlurhash is a module for ProcessWire CMS which automatically generates Blurhash strings for uploaded images.

What is Blurhash?

BlurHash is a compact representation of a placeholder for an image. E.g. used for lazy loading placeholders.

More about Blurhash itself:

Usage

Installation

  1. Execute the following command in the root directory of your ProcessWire installation:
composer require blue-tomato/image-blurhash
  1. ProcessWire will detect the module and list it in the backend's Modules > Site > ImageBlurhash section. Navigate there and install it.

Configuration

Activate Blurhash in the field setting of the image: Setup > Fields > image_field > Details > Generate Blurhash Strings

API

$page->image_field->blurhash

Return's the encoded Blurhash as string or false if not existing


$page->image_field->getBlurhashDataUri(float $width, float $height)

E.g.

<img src="$page->image_field->getBlurhashDataUri(500, 300)" alt="" data-lazy="$page->image_field->size(500, 300)" />

Returns the decoded Blurhash as base64 PNG datauri for usage in an image. If not existing transparent GIF image will be returned.

Hint: If your image is 500x300 pixels, you can use 50x30 for the Blurhash Data-URI and and scale up the image with CSS. This makes Blurhash decoding faster, the data-uri smaller but the quality is still good.

Migration of existing images

For migration of existing fields there are two CLI script in the module directory

regenerateImages.php

E.g.

php regenerateImages.php

Generates for all image fields who have the createBlurhash option new Blurhashs.

generateEmptyImages.php

E.g.

php generateEmptyImages.php

Generates for all image fields who have the createBlurhash option and have no Blurhash in the database a new Blurhash.

Roadmap

Currently encoding component quality default to 4x3. In the future this value will be configurable over the field settings for each field.

Support

Please open an issue for support.

Contributing

Create a branch on your fork, add commits to your fork, and open a pull request from your fork to this repository.

To get better insights and onboard you on module implementation details just open a support issue. We'll get back to you asap.

License

Find all information about this module's license in the LICENCE.txt file.

imageblurhash's People

Contributors

tiefenb avatar yuters avatar

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.