laravolt/avatar

setTheme() border size bug

Closed this issue · 3 comments

When the border size is set to 0, setTheme does not work at all.
When the border size is set to 1, setTheme randomly picks from colors and grayscale.
setTheme() only seems to be working correctly when using a border size of 2+

Could this be a confusion with true/false somewhere in the code?

uyab commented

Patch version tagged: 4.1.2

uyab commented

Sorry, I think it was by design:

// OK, call setXX after create()
app('avatar')->create('John')->setTheme('pastel')->setBorder(5, '#FFFFFF')->toBase64();

// NOT OK, call setXX before create(), because create($name) is what make the avatar can be generated based on $name supplied
// So, basically if you call setXXX() before create(), your overriden theme will be overriden again by create()
app('avatar')->setTheme('pastel')->setBorder(5, '#FFFFFF')->create('John')->toBase64();

Looks like you may still be tweaking things, but updating to 4.1.3 seems to have resolved this issue for me.