class PathProcessorImageStyles implements InboundPathProcessorInterface (View source)

Defines a path processor to rewrite image styles URLs.

As the route system does not allow arbitrary amount of parameters convert the file path to a query parameter on the request.

This processor handles two different cases:

  • public image styles: In order to allow the webserver to serve these files directly, the route is registered under the same path as the image style so it took over the first generation. Therefore the path processor converts the file path to a query parameter.
  • private image styles: In contrast to public image styles, private derivatives are already using system/files/styles. Similar to public image styles, it also converts the file path to a query parameter.

Properties

protected StreamWrapperManagerInterface $streamWrapperManager

The stream wrapper manager service.

Methods

__construct(StreamWrapperManagerInterface $stream_wrapper_manager)

Constructs a new PathProcessorImageStyles object.

string
processInbound(string $path, Request $request)

Processes the inbound path.

Details

__construct(StreamWrapperManagerInterface $stream_wrapper_manager)

Constructs a new PathProcessorImageStyles object.

Parameters

StreamWrapperManagerInterface $stream_wrapper_manager

The stream wrapper manager service.

string processInbound(string $path, Request $request)

Processes the inbound path.

Implementations may make changes to the request object passed in but should avoid all other side effects. This method can be called to process requests other than the current request.

Parameters

string $path

The path to process, with a leading slash.

Request $request

The HttpRequest object representing the request to process. Note, if this method is being called via the path_processor_manager service and is not part of routing, the current request object must be cloned before being passed in.

Return Value

string

The processed path.