Arabic (utf8) not working
Closed this issue · 6 comments
@balin09 could you provide some sample code?
And also, how is your current output? Does it still display text in latin?
@uyab here some code
avatar.php:
`
'driver' => env('IMAGE_DRIVER', 'gd'),
// Initial generator class
'generator' => \Laravolt\Avatar\Generator\DefaultGenerator::class,
// Whether all characters supplied must be replaced with their closest ASCII counterparts
'ascii' => false,
// Image shape: circle or square
'shape' => 'square',
// Image width, in pixel
'width' => 100,
// Image height, in pixel
'height' => 70,
// Number of characters used as initials. If name consists of single word, the first N character will be used
'chars' => 2,
// font size
'fontSize' => 38,
// convert initial letter in uppercase
'uppercase' => true,
'rtl' => false,
// Fonts used to render text.
// If contains more than one fonts, randomly selected based on name supplied
'fonts' => [__DIR__ . '/../fonts/Tajawal-Medium.ttf'],
// List of foreground colors to be used, randomly selected based on name supplied
'foregrounds' => [
'#FFFFFF',
],
...
`
call avatar
img class="rounded-full" src="{{ Avatar::create($user['fname'].$user['lname'])->toBase64() }}" alt="User image"
and here the ouptput:
anyone try this plugin and worked with Arabic language ?
I downloaded (hopefully) the same font from https://www.fontpalace.com/font-download/tajawal-medium/ and its just works as expected.
Can you validate if you have setup the fonts path correctly? Something like dd(config('laravolt.avatar.fonts'))
and see if the output was correct.
@uyab
So sorry for late response
my bad i get confused with font path in avatar.php i thought it was correct ..., now it worked fine when i change it.
but now i have an other problem: with arabic name it take 2 initial from first name only, exp for ( Imad Abd ) i expect [I A] but i get [Im].
here is the output
even with english sometimes the same probleme happen:
and also the output for rtl=>true or false ar the same for english and arabic here is my config
You can create your own InitialGenerator class. Please check the configuration file.