<?php
namespace Intervention\Image\Imagick;
use Intervention\Image\AbstractEncoder;
use Intervention\Image\Exception\NotSupportedException;
class Encoder extends AbstractEncoder
{
/**
* Processes and returns encoded image as JPEG string
*
* @return string
*/
protected function processJpeg()
{
$format = 'jpeg';
$compression = \Imagick::COMPRESSION_JPEG;
$imagick = $this->image->getCore();
$imagick->setImageBackgroundColor('white');
$imagick->setBackgroundColor('white');
$imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE);
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$imagick->setCompressionQuality($this->quality);
$imagick->setImageCompressionQuality($this->quality);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as PNG string
*
* @return string
*/
protected function processPng()
{
$format = 'png';
$compression = \Imagick::COMPRESSION_ZIP;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as GIF string
*
* @return string
*/
protected function processGif()
{
$format = 'gif';
$compression = \Imagick::COMPRESSION_LZW;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF);
return $imagick->getImagesBlob();
}
protected function processWebp()
{
if ( ! \Imagick::queryFormats('WEBP')) {
throw new NotSupportedException(
"Webp format is not supported by Imagick installation."
);
}
$format = 'webp';
$compression = \Imagick::COMPRESSION_JPEG;
$imagick = $this->image->getCore();
$imagick->setImageBackgroundColor(new \ImagickPixel('transparent'));
$imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE);
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$imagick->setImageCompressionQuality($this->quality);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as TIFF string
*
* @return string
*/
protected function processTiff()
{
$format = 'tiff';
$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);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_TIFF_II);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as BMP string
*
* @return string
*/
protected function processBmp()
{
$format = 'bmp';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_BMP);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as ICO string
*
* @return string
*/
protected function processIco()
{
$format = 'ico';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_ICO);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as PSD string
*
* @return string
*/
protected function processPsd()
{
$format = 'psd';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$this->image->mime = image_type_to_mime_type(IMAGETYPE_PSD);
return $imagick->getImagesBlob();
}
/**
* Processes and returns encoded image as AVIF string
*
* @return string
*/
protected function processAvif()
{
if ( ! \Imagick::queryFormats('AVIF')) {
throw new NotSupportedException(
"AVIF format is not supported by Imagick installation."
);
}
$format = 'avif';
$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();
}
/**
* 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();
}
}
At NFC Pay, we strive to provide a seamless and satisfactory experience with our services. This Refund Policy outlines the circumstances under which refunds may be issued for transactions made through our platform. Please read this policy carefully to understand your rights regarding refunds.
1. Eligibility for Refunds
Refunds may be considered under the following circumstances:
2. Non-Refundable Situations
Refunds will generally not be issued in the following situations:
3. Refund Process
To request a refund, please follow these steps:
4. Refund Exceptions
Certain transactions may be subject to specific terms and conditions, including non-refundable fees or charges. Please review the terms associated with each transaction carefully, as some fees may not be eligible for refunds.
5. Modifications to the Refund Policy
NFC Pay reserves the right to modify this Refund Policy at any time. Changes will be communicated through updates on our website and app, and the effective date will be updated accordingly. We encourage you to review this policy periodically to stay informed about our refund practices.
By using NFC Pay, you agree to this Refund Policy and understand the terms under which refunds may be issued. Our goal is to ensure a fair and transparent refund process, providing you with confidence and peace of mind when using our services.