Giter Site home page Giter Site logo

Arabic (utf8) not working about avatar HOT 6 CLOSED

balin09 avatar balin09 commented on June 10, 2024
Arabic (utf8) not working

from avatar.

Comments (6)

uyab avatar uyab commented on June 10, 2024

@balin09 could you provide some sample code?

And also, how is your current output? Does it still display text in latin?

from avatar.

balin09 avatar balin09 commented on June 10, 2024

@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:

Capture d’écran 2021-09-02 131057

from avatar.

balin09 avatar balin09 commented on June 10, 2024

anyone try this plugin and worked with Arabic language ?

from avatar.

uyab avatar uyab commented on June 10, 2024

I downloaded (hopefully) the same font from https://www.fontpalace.com/font-download/tajawal-medium/ and its just works as expected.
image

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.

from avatar.

balin09 avatar balin09 commented on June 10, 2024

@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

image

even with english sometimes the same probleme happen:

image

and also the output for rtl=>true or false ar the same for english and arabic here is my config

image

from avatar.

uyab avatar uyab commented on June 10, 2024

You can create your own InitialGenerator class. Please check the configuration file.

from avatar.

Related Issues (20)

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.