Set jpeg adapter

@param \PHPImageOptim\Tools\Jpeg\JpegOptim $jpegOptim
@return \Extlib\ImageOptimizer
13950
public function setJpegOptim(\PHPImageOptim\Tools\Jpeg\JpegOptim $jpegOptim)
    {
        $this->jpegOptim = $jpegOptim;
        return $this;
    }
626406
private function registerOptimizers()
    {
        ImagerService::registerOptimizer('jpegoptim', JpegoptimOptimizer::class);
        ImagerService::registerOptimizer('jpegtran', JpegtranOptimizer::class);
        ImagerService::registerOptimizer('mozjpeg', MozjpegOptimizer::class);
        ImagerService::registerOptimizer('optipng', OptipngOptimizer::class);
        ImagerService::registerOptimizer('pngquant', PngquantOptimizer::class);
        ImagerService::registerOptimizer('gifsicle', GifsicleOptimizer::class);
        ImagerService::registerOptimizer('tinypng', TinypngOptimizer::class);
        ImagerService::registerOptimizer('kraken', KrakenOptimizer::class);
        ImagerService::registerOptimizer('imageoptim', ImageoptimOptimizer::class);
    }
357616
public function setJpegQuality($quality)
  {
    if (!is_numeric($quality) ||
      $quality < 0 ||
      $quality > 100) {
      throw new \Exception('Qualité JPEG : valeur numérique attendue de 0 à 100');
    }
    $this->jpgQuality = $quality;
  }
607432
public function setDefaultImage($defaultImage = '')
    {
        if (empty($defaultImage)) {
            $image        = DataRepository::getData('config_image');
            $defaultImage = $image['default_image'];
        }
        $this->defaultImage = $defaultImage;

        return $this;
    }
1152334
public function jpegQualitySetting($quality)
    {
        // Work on quality
        $q = is_bool($quality) && $quality ? 72 : (integer) $quality;
        $q = 0 < $q && $q <= 100 ? $q : 72;

        // Apply filter hook
        add_filter('jpeg_quality', function () use ($q) {
            return $q;
        });
    }
334780
public function setFilePointer($pointer)
	{
		if(!is_resource($pointer))
			throw new InvalidArgumentException("Invalid type - not a file resource");
		
		$this->pointer = $pointer;
		
		# and now to set everything up...
		$metadata = stream_get_meta_data($this->pointer);
		
		# can this stream be read from?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_readable = true;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_readable = $super;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# can this stream be written to?
		if(isset($metadata["mode"]))
		{
			$mode = rtrim($metadata["mode"], "bt");
			
			$super = (boolean) preg_match("/\+$/", $mode);
			$mode = rtrim($mode, "+");
			
			switch($mode)
			{
				case "r":
					$this->is_writable = $super;
				break;
				
				case "w":
				case "a":
				case "x":
				case "c":
					$this->is_writable = true;
				break;
				
				default:
					throw new LogicException("Invalid file access type: '".$metadata["mode"]."'");
				break;
			}
		}
		
		# does this stream support seek functionality?
		if(isset($metadata["seekable"]))
			$this->is_seekable = (boolean) $metadata["seekable"];
		
		return null;
	}
816542
public function setMimeType(string $mime_type) {
        if(!$this->setModified('mime_type', $mime_type)->isModified()) {
            return $this;
        }
		$this->mime_type = $mime_type;
		return $this;
    }
1037353
public function setAdapter($options = null)
    {
        if (is_string($options)) {
            $adapter = $options;
        } elseif (isset($options['adapter'])) {
            $adapter = $options['adapter'];
            unset($options['adapter']);
        } else {
            $adapter = 'BlockCipher';
        }

        if (!is_array($options)) {
            $options = [];
        }

        if (class_exists('Zend\Filter\Encrypt\\' . ucfirst($adapter))) {
            $adapter = 'Zend\Filter\Encrypt\\' . ucfirst($adapter);
        } elseif (!class_exists($adapter)) {
            throw new Exception\DomainException(
                sprintf(
                    '%s expects a valid registry class name; received "%s", which did not resolve',
                    __METHOD__,
                    $adapter
                )
            );
        }

        $this->adapter = new $adapter($options);
        if (!$this->adapter instanceof Encrypt\EncryptionAlgorithmInterface) {
            throw new Exception\InvalidArgumentException(
                "Encoding adapter '" . $adapter
                . "' does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithmInterface"
            );
        }

        return $this;
    }
1080038
public function setType($type)
    {
        $allowed = array(
            Zend_Mime::MULTIPART_ALTERNATIVE,
            Zend_Mime::MULTIPART_MIXED,
            Zend_Mime::MULTIPART_RELATED,
        );
        if (!in_array($type, $allowed)) {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Invalid content type "' . $type . '"');
        }

        $this->_type = $type;
        return $this;
    }
1276601
protected function createImageObject()
    {

        // Check if the file is a valid file
        if ( ! is_file( $this->originalImagePath ) ) {
            throw new Exception( sprintf( '%s: No image found.', $this->originalImagePath ) );
        }

        // Get the mimetype
        $this->imageType = exif_imagetype( $this->originalImagePath );

        // Get the width and height of image
        list($this->width, $this->height) = getimagesize($this->originalImagePath);


        // Create GD object based on the mime type
        switch ( $this->imageType ) {
            case IMAGETYPE_GIF:
                $this->image = imagecreatefromgif( $this->originalImagePath );
                break;

            case IMAGETYPE_PNG:
                $this->image = @imagecreatefrompng( $this->originalImagePath );
                break;

            case IMAGETYPE_JPEG:
                $this->image = @imagecreatefromjpeg( $this->originalImagePath );
                break;

            case IMAGETYPE_BMP:
                $this->image = imagecreatefromwbmp( $this->originalImagePath );
                break;

            // If the image is not one of the previous mimetype
            // We throw an exception
            default:
                throw new Exception( sprintf( 'This MimeType is not supported: %s. Image processed: %s', image_type_to_mime_type( $this->imageType ), $this->originalImagePath ) );
                break;
        }

        // Check if the object is successfully opened
        if( ! $this->image ) {
            throw new Exception( sprintf( 'We could not open this image: %s', $this->originalImagePath ) );
        }

    }
276317
public function setLineColor($r, $g, $b)
    {

        $this->ink['line'] = imagecolorallocate($this->im, $r, $g, $b);
    }
26831
public function setMIMEType(string $mimetype)
    {
        if ($this->discoverInterface()) {
            $this->nb_interface->setMIMEType($mimetype);
        } else {
            throw new ENabuRenderException(
                ENabuRenderException::ERROR_RENDER_NOT_FOUND,
                array($this->nb_descriptor->getKey())
            );
        }

        return $this;
    }
999784
private function createFromJpeg(string $path): self
    {
        $imageData = imagecreatefromjpeg($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create JPEG image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->encrypted = false;
        if (true === $this->autorotate) {
            $this->autoRotate($path);
        }
        return $this;
    }
602509
public function setFileFormat($format)
    {
        if (!in_array($format, array(self::FORMAT_BMP, self::FORMAT_TGA))) {
            throw new \InvalidArgumentException('Invalid file format: '.$format, ErrorCodes::INVALID_VALUE);
        }
        $this->setArgument('f', $format);
        return $this;
    }
22929
public function setImageFileName($imageFileName)
    {
        $this->imageFileName = $imageFileName;

        if ($imageFileName) {
            $this->setImage('/uploads/images/'.$imageFileName);
            if ( ! $this->link) {
                $this->link = '/uploads/images/'.$imageFileName;
            }
        } else {
            // Remove deleted file from database
            if ($this->link == $this->image) {
                $this->link = null;
            }
            $this->setImage(null);
        }

        return $this;
    }
246020
public function setThumbnailsFormat($thumbnailsFormat)
    {
        $thumbnailsFormat = strtolower(trim((string) $thumbnailsFormat));
        if ($thumbnailsFormat !== ThumbnailFormatService::FORMAT_AUTO) {
            if (!$this->app->make(BitmapFormat::class)->isFormatValid($thumbnailsFormat)) {
                $thumbnailsFormat = BitmapFormat::FORMAT_JPEG;
            }
        }
        $this->thumbnailsFormat = $thumbnailsFormat;

        return $this;
    }
718982
public function setEnableImageMagick($enable)
    {
        if (!is_bool($enable)) {
            throw new \InvalidArgumentException(
                "enableImageMagick can only assume boolean values. Specified value: $enable.");
        }

        // Verify that the Imagick extension is installed
        if ($enable && !extension_loaded('imagick')) {
            throw new \Exception(
                'Failed to enable ImageMagick. '.
                'The Imagick PHP extension was not found on this system.');
        }
        
        $this->enableImageMagick = $enable;
    }