protected function generateImagePayload(
        $image, ?string $alt, array $extra, bool $default, bool $storage = false
    ): ?ResourceSettings  {
        $image = $this->createImageSettings($image, $alt, $extra, $default, $storage);

        if ($this->hasCachedImage($image)) {
            return $this->getCachedImage($image);
        }

        $image->hasRequiredSettings();

        if (!$storage && !$image instanceof RemoteSettings && !$this->exists($image->image, $image->theme)) {
            if (!$default && $this->themeIsDefault($image->theme)) {
                return $this->generateImagePayload($image, $alt, $extra, true);
            }

            $this->missing($image->image, $image->theme);

            // Null returned
            return $this->cacheImage($image);
        }

        return $this->cacheImage($image);
    }
protected function generateImagePayload(
        $image, ?string $alt, array $extra, bool $default, bool $storage = false
    ): ?ResourceSettings  {
        $image = $this->createImageSettings($image, $alt, $extra, $default, $storage);

        if ($this->hasCachedImage($image)) {
            return $this->getCachedImage($image);
        }

        $image->hasRequiredSettings();

        if (!$storage && !$image instanceof RemoteSettings && !$this->exists($image->image, $image->theme)) {
            if (!$default && $this->themeIsDefault($image->theme)) {
                return $this->generateImagePayload($image, $alt, $extra, true);
            }

            $this->missing($image->image, $image->theme);

            // Null returned
            return $this->cacheImage($image);
        }

        return $this->cacheImage($image);
    }
protected function generateImagePayload ( $ image , ? string $ alt , array $ extra , bool $ default , bool $ storage = false ) : ? ResourceSettings { $ image = $ this -> createImageSettings ( $ image , $ alt , $ extra , $ default , $ storage ) ; if ( $ this -> hasCachedImage ( $ image ) ) { return $ this -> getCachedImage ( $ image ) ; } $ image -> hasRequiredSettings ( ) ; if ( ! $ storage && ! $ image instanceof RemoteSettings && ! $ this -> exists ( $ image -> image , $ image -> theme ) ) { if ( ! $ default && $ this -> themeIsDefault ( $ image -> theme ) ) { return $ this -> generateImagePayload ( $ image , $ alt , $ extra , true ) ; } $ this -> missing ( $ image -> image , $ image -> theme ) ; // Null returned return $ this -> cacheImage ( $ image ) ; } return $ this -> cacheImage ( $ image ) ; }
Create the image payload

@param             $image
@param null|string $alt
@param array       $extra
@param bool        $default
@param bool        $storage
@return \Laranix\Themer\ResourceSettings|\Laranix\Themer\Images\LocalSettings
@throws \Laranix\Support\Exception\InvalidTypeException
Create the image payload