Novis\Image\Image::PlaceholderKind
The kind of placeholder Image::placeholder returns.
Image::PlaceholderKind is declared in the class Novis\Image\Image.
A placeholder is a short text that describes the colours of an image. A web page draws a blurred picture from it while the real image loads. You save the placeholder next to the image, and the browser decodes it with a small script for that format.
BlurHashis 28 characters. It has no transparency.ThumbHashis base64 text. It also keeps transparency.
Choose the format that your front-end library reads.
Examples
Two placeholders
<?nvs// Shows the text each `Image::PlaceholderKind` returns for the same image.use Novis\Image\Color;use Novis\Image\Image;
// An orange image of 120 by 80 pixels, encoded as PNG.tainted bytes $photo = Image::create(120, 80, Color::hex('#f97316'))->encode();
string $blur = Image::placeholder($photo, Image::PlaceholderKind::BlurHash);string $thumb = Image::placeholder($photo, Image::PlaceholderKind::ThumbHash);
echo $blur, ' (', Core\Str::length($blur), " characters)\n";echo $thumb, ' (', Core\Str::length($thumb), " characters)\n";L4Sn3|=cfQ=c}WjtfQjtfQfQfQfQ (28 characters)4AwDBYCHh4iHiHePh4iHiXh3f4j4 (28 characters)