Вход Регистрация
Файл: vendor/intervention/image/src/Encoders/FilePathEncoder.php
Строк: 65
<?php

declare(strict_types=1);

namespace 
InterventionImageEncoders;

use 
InterventionImageInterfacesImageInterface;
use 
InterventionImageInterfacesEncodedImageInterface;

class 
FilePathEncoder extends FileExtensionEncoder
{
    
/**
     * Create new encoder instance to encode to format of file extension in given path
     *
     * @param null|string $path
     * @return void
     */
    
public function __construct(protected ?string $path nullmixed ...$options)
    {
        
parent::__construct(
            
is_null($path) ? $path pathinfo($pathPATHINFO_EXTENSION),
            ...
$options
        
);
    }

    
/**
     * {@inheritdoc}
     *
     * @see EncoderInterface::encode()
     */
    
public function encode(ImageInterface $image): EncodedImageInterface
    
{
        return 
$image->encode(
            
$this->encoderByFileExtension(
                
is_null($this->path) ? $image->origin()->fileExtension() : pathinfo($this->pathPATHINFO_EXTENSION)
            )
        );
    }
}
Онлайн: 0
Реклама