mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
Added: Incorrect image orientation
This commit is contained in:
parent
217207883f
commit
e3b62d24d8
87 changed files with 10461 additions and 21 deletions
41
rainloop/v/0.0.0/app/libraries/Imagine/Gd/Font.php
Normal file
41
rainloop/v/0.0.0/app/libraries/Imagine/Gd/Font.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Imagine package.
|
||||
*
|
||||
* (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Imagine\Gd;
|
||||
|
||||
use Imagine\Exception\RuntimeException;
|
||||
use Imagine\Image\AbstractFont;
|
||||
use Imagine\Image\Box;
|
||||
|
||||
/**
|
||||
* Font implementation using the GD library
|
||||
*/
|
||||
final class Font extends AbstractFont
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function box($string, $angle = 0)
|
||||
{
|
||||
if (!function_exists('imageftbbox')) {
|
||||
throw new RuntimeException('GD must have been compiled with `--with-freetype-dir` option to use the Font feature.');
|
||||
}
|
||||
|
||||
$angle = -1 * $angle;
|
||||
$info = imageftbbox($this->size, $angle, $this->file, $string);
|
||||
$xs = array($info[0], $info[2], $info[4], $info[6]);
|
||||
$ys = array($info[1], $info[3], $info[5], $info[7]);
|
||||
$width = abs(max($xs) - min($xs));
|
||||
$height = abs(max($ys) - min($ys));
|
||||
|
||||
return new Box($width, $height);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue