Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
languagephp
themeRDark
titleView\PrintImage
use Brandbox\Framework\Base\File;
use Brandbox\Framework\Base\Image as BaseImage;
use Brandbox\PrintCore\PrintDocument\Image as PrintDocumentImage;
use Brandbox\PrintLayoutStandard\View\PrintImage;
use Brandbox\PrintStyleguide;

private function image(PrintStyleguide\Entity\PrintImage $element, PrintImage\Lib\Entity\PrintViewImage $sourcearray $settings): void
{    
 	$file = $this->getFile($source->image$settings['image']);
 
  $attributes = $this->getImageAttributes($file, $source);
    $image = $this->getImage($file, $source);

    if ('' !== $image) {
        $element->settings['src'] = $image;
        $element->settings['width'] = $attributes->getWidth();
        $element->settings['height'] = $attributes->getHeight();
    }
}

private function getImage(File\lib\entity\mamFile $file, PrintImage\Lib\Entity\PrintViewImage $source): string
{
    $image = new PrintDocumentImage\Lib\Struct\ImageRequest();

   $image->file = $file;
    $image->width = $source->width;
    $image->height = $source->height;
    $image->crop = $source->crop;

    return $this
        ->staticController(PrintDocumentImage\Manager::class)
        ->get($image$file)
    ;
}

private function getFile(string $path): File\lib\entity\mamFile
{
    return $this
        ->staticController(File\Manager::class)
        ->findByPath($path, true)
  
 ; }  private function getImageAttributes(File\lib\entity\mamFile $file, PrintImage\Lib\Entity\PrintViewImage $source): BaseImage\Lib\Struct\ImageAttributes
{
    $params = [];
    if ($source->crop) {
        $params['crop'] = $source->crop;
    }

    $attributes = $this
        ->staticController(File\Manager::class)
        ->imageAttributes($file, $source->width, $source->height, $params)
    ;

    $source->width = $attributes->getWidth();
    $source->height = $attributes->getHeight();

    return $attributes;
}