Hello , still the same outline error : even now on shared hosting !!
Maybe webmasters of shared hosting have updated imagemagick version...
The result a normal outline 2 month ago ... on shared hosting (what can make such change with php ? )
And now the same result like my dedicated server ....
So to be clear :
- 2 dedicated server DEBIAN 7 -> outline impossible with some fonts (not all 70% error)
- 2 hosting shared -> outline impossible with some fonts (not all 70% error)
I use imagegik for years on 4 hosting .
Can someone of image magick make search and fixe this .. Thanks It's very annoying, i will have to go back to GD library ??
And config on Shared hosting
An my code : i repeat it works with some fonts perfectly but with differents font it creates errors.
Code: Select all
$font='lobster.ttf';
$n0='test.png';
$font_size=70;
$text='outline';
$stroke_w=4;
$draw = new ImagickDraw();
$draw->setFont($font);
$ft_real_s = $font_size*1.31;
$color_text='#000000';
$color_stoke='#1e90ff';
$draw->setFontSize($ft_real_s);
$draw->setStrokeAntialias(true);
$draw->setTextAntialias(true);
$draw->setGravity(Imagick::GRAVITY_NORTHWEST);
$offset_stroke=($stroke_w*2);
$image_size = new Imagick();
$metrics = $image_size->queryFontMetrics($draw, $text);
$width = $metrics['textWidth']+$offset_stroke*2;
$height = $metrics['textHeight']+$offset_stroke*2;
$draw->setFillColor($color_text);
$textOnly = new Imagick();
$textOnly->newImage($width,$height, "transparent");
$textOnly->annotateImage($draw, $offset_stroke, $offset_stroke, 0, $text);
//Create stroke
$draw->setFillColor($color_stoke);
$draw->setStrokeColor($color_stoke);
$draw->setStrokeWidth($stroke_w);
$strokeImage = new Imagick();
$strokeImage->newImage($width,$height, "transparent");
$strokeImage->annotateImage($draw, $offset_stroke, $offset_stroke, 0, $text);
//Composite text over stroke
$strokeImage->compositeImage($textOnly, imagick::COMPOSITE_OVER, 0, 0, Imagick::CHANNEL_ALPHA );
$strokeImage->trimImage(0);
$strokeImage->writeImage($n0);
$image_url=$n0;
$draw->clear();
$draw->destroy();
$strokeImage->clear();
$strokeImage->destroy();
$textOnly->clear();
$textOnly->destroy();