1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-21 05:41:58 +02:00

Intervention upgraded to v2.7.0

PHPMailer upgraded to v6.5.3
This commit is contained in:
Cameron
2021-12-01 12:10:23 -08:00
parent 577bcb89e1
commit 0ddcd4d23d
23 changed files with 359 additions and 104 deletions

View File

@@ -91,6 +91,13 @@ abstract class AbstractEncoder
*/
abstract protected function processAvif();
/**
* Processes and returns image as Heic encoded string
*
* @return string
*/
abstract protected function processHeic();
/**
* Process a given image
*
@@ -141,7 +148,6 @@ abstract class AbstractEncoder
$this->result = $this->processTiff();
break;
case 'bmp':
case 'bmp':
case 'ms-bmp':
case 'x-bitmap':
@@ -182,6 +188,12 @@ abstract class AbstractEncoder
case 'image/avif':
$this->result = $this->processAvif();
break;
case 'heic':
case 'image/heic':
case 'image/heif':
$this->result = $this->processHeic();
break;
default:
throw new NotSupportedException(

View File

@@ -69,7 +69,7 @@ abstract class AbstractFont
* @return boolean
*/
abstract public function applyToImage(Image $image, $posx = 0, $posy = 0);
/**
* Calculates bounding box of current font setting
*
@@ -91,7 +91,7 @@ abstract class AbstractFont
* Set text to be written
*
* @param String $text
* @return void
* @return self
*/
public function text($text)
{
@@ -114,7 +114,7 @@ abstract class AbstractFont
* Set font size in pixels
*
* @param int $size
* @return void
* @return self
*/
public function size($size)
{
@@ -137,7 +137,7 @@ abstract class AbstractFont
* Set color of text to be written
*
* @param mixed $color
* @return void
* @return self
*/
public function color($color)
{
@@ -160,7 +160,7 @@ abstract class AbstractFont
* Set rotation angle of text
*
* @param int $angle
* @return void
* @return self
*/
public function angle($angle)
{
@@ -183,7 +183,7 @@ abstract class AbstractFont
* Set horizontal text alignment
*
* @param string $align
* @return void
* @return self
*/
public function align($align)
{
@@ -206,7 +206,7 @@ abstract class AbstractFont
* Set vertical text alignment
*
* @param string $valign
* @return void
* @return self
*/
public function valign($valign)
{
@@ -250,7 +250,7 @@ abstract class AbstractFont
* Set path to font file
*
* @param string $file
* @return void
* @return self
*/
public function file($file)
{

View File

@@ -36,6 +36,8 @@ class IptcCommand extends AbstractCommand
$data['Category'] = isset($iptc["2#015"][0]) ? $iptc["2#015"][0] : null;
$data['Subcategories'] = isset($iptc["2#020"][0]) ? $iptc["2#020"][0] : null;
$data['Keywords'] = isset($iptc["2#025"][0]) ? $iptc["2#025"] : null;
$data['ReleaseDate'] = isset($iptc["2#030"][0]) ? $iptc["2#030"][0] : null;
$data['ReleaseTime'] = isset($iptc["2#035"][0]) ? $iptc["2#035"][0] : null;
$data['SpecialInstructions'] = isset($iptc["2#040"][0]) ? $iptc["2#040"][0] : null;
$data['CreationDate'] = isset($iptc["2#055"][0]) ? $iptc["2#055"][0] : null;
$data['CreationTime'] = isset($iptc["2#060"][0]) ? $iptc["2#060"][0] : null;

View File

@@ -16,8 +16,9 @@ class ResetCommand extends AbstractCommand
public function execute($image)
{
$backupName = $this->argument(0)->value();
if (is_resource($backup = $image->getBackup($backupName))) {
$backup = $image->getBackup($backupName);
if (is_resource($backup) || $backup instanceof \GdImage) {
// destroy current resource
imagedestroy($image->getCore());

View File

@@ -57,6 +57,11 @@ class Encoder extends \Intervention\Image\AbstractEncoder
return $buffer;
}
/**
* Processes and returns encoded image as WEBP string
*
* @return string
*/
protected function processWebp()
{
if ( ! function_exists('imagewebp')) {
@@ -141,9 +146,35 @@ class Encoder extends \Intervention\Image\AbstractEncoder
* @return string
*/
protected function processAvif()
{
if ( ! function_exists('imageavif')) {
throw new NotSupportedException(
"AVIF format is not supported by PHP installation."
);
}
ob_start();
$resource = $this->image->getCore();
imagepalettetotruecolor($resource);
imagealphablending($resource, true);
imagesavealpha($resource, true);
imageavif($resource, null, $this->quality);
$this->image->mime = defined('IMAGETYPE_AVIF') ? image_type_to_mime_type(IMAGETYPE_AVIF) : 'image/avif';
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
/**
* Processes and returns encoded image as HEIC string
*
* @return string
*/
protected function processHeic()
{
throw new NotSupportedException(
"AVIF format is not supported by Gd Driver."
"HEIC format is not supported by Gd Driver."
);
}
}

View File

@@ -183,6 +183,11 @@ class Encoder extends AbstractEncoder
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as AVIF string
*
* @return string
*/
protected function processAvif()
{
if ( ! \Imagick::queryFormats('AVIF')) {
@@ -204,4 +209,31 @@ class Encoder extends AbstractEncoder
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as HEIC string
*
* @return string
*/
protected function processHeic()
{
if ( ! \Imagick::queryFormats('HEIC')) {
throw new NotSupportedException(
"HEIC format is not supported by Imagick installation."
);
}
$format = 'heic';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$imagick->setCompressionQuality($this->quality);
$imagick->setImageCompressionQuality($this->quality);
return $imagick->getImagesBlob();
}
}