Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arabic Letter #775

Open
netcase911 opened this issue Sep 8, 2017 · 1 comment
Open

Arabic Letter #775

netcase911 opened this issue Sep 8, 2017 · 1 comment

Comments

@netcase911
Copy link

Hello ,

when I try to generated image the Arabic letter appear in not correct position show like ( Mirrored) for example it show like LTR , how I can fix this issue please ?
kindly check the code in below

public function preview($id, Request $request)
{
    $msg = Message::find( $id );
    $string = wordwrap($msg->body,38,"|");
    $strings = explode("|",$string);
    $size = 42;
    $img = Image::canvas(500, 500, '#' . env('SHARE_IMAGE_BACKGROUND_COLOR') );
    $img->insert( storage_path('app/private/share-image.png') );
    $i = ( 500 - ( count( $strings) * ( $size + 2 ) ) ) / 2;
    foreach( $strings AS $s )
    {
        $img->text($s, 250, $i, function($font) {
            $font->file(storage_path('app/private/font.ttf') );
            $font->size(42);
            $font->color('#000000');
            $font->align('center');
            $font->valign('center');
        });
        $i = $i + ( $size - 1);
    }
    $img->text( env('APP_DOMAIN'), 15, 478, function($font) {
        $font->file(storage_path('app/private/font.ttf') );
        $font->size(40);
        $font->color('#ffffff');
    });
    return $img->response('png', 70);
}


/*
public function profile($username, Request $request)
{
    $user = User::where('username', $username)->first();

    $img = Image::make( storage_path('app/private/profile-image.png'));

    $img->text( 'leave me anonymous feedback', 250, 45, function($font) {
        $font->file(storage_path('app/private/font.ttf') );
        $font->size(50);
        $font->color('#ffffff');
        $font->align('center');
        $font->valign('center');
    });

    $img->insert( $user->image ? url('/uploads/images/'.$user->image) : 'http://via.placeholder.com/200x200/2c3e50/ffffff?text=no+image', 'center-center');

    $img->text( $username.'.'.env('APP_DOMAIN'), 250, 455, function($font) {
        $font->file(storage_path('app/private/font.ttf') );
        $font->size(38);
        $font->color('#ffffff');
        $font->align('center');
        $font->valign('center');
    });

    return $img->response('png', 75);
}
*/`
@soheylfarzane
Copy link

You can revers array of letters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants