Skip to content

Instantly share code, notes, and snippets.

View joetannenbaum's full-sized avatar

Joe Tannenbaum joetannenbaum

View GitHub Profile
<?php
namespace App\Livewire\Attributes;
use Attribute;
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute;
use function Livewire\store;
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
<?php
function imageToAscii($path, $maxWidth = 100, $maxHeight = 100)
{
$contrast = 5;
$characters = str_split(
str_repeat(' ', $contrast * 10)
. '`.-\':_,^=;><+!rc*/z?sLTv)J7(|Fi{C}fI31tlu[neoZ5Yxjya]2ESwqkP6h9d4VpOGbUAKXHm8RD#$Bg0MNWQ%&@'
);