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

imageintervention write text to image results in different sizes depending on resolution of image #657

Open
nikocraft opened this issue Jan 6, 2017 · 1 comment

Comments

@nikocraft
Copy link

This is my code:

    ImgResizer::make($folder . '/'.$name)->text($watermark->body, $width-15, $height-10, function($font) {
        $font->file(public_path('fonts/NunitoSans-Regular.ttf'));
        $font->size(52);
        $font->color('#ffffff');
        $font->align('right');
        $font->valign('bottom');
       })->save();

I am using text to insert a simple watermark. The problem is that text is not the same size on different resolutions.

for example:
image 1

image 2

image 3

Why is it different like that, is this a bug? What can I do to keep it the same size on all images?

@matthewnessworthy
Copy link

if you want to have the text at the same size relative to the resolution of the image you're going to have to calculate the font size manually

e.g., if your image is 100x100, and you use a font size of 10, you might need to use a font size of 20 another image is 200x200

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