public function applyTransformations(EventInterface $event) {
        $request = $event->getRequest();
        $image = $event->getResponse()->getModel();
        $presets = $event->getConfig()['transformationPresets'];

        // Fetch transformations specifed in the query and transform the image
        foreach ($request->getTransformations() as $transformation) {
            if (isset($presets[$transformation['name']])) {
                // Preset
                foreach ($presets[$transformation['name']] as $name => $params) {
                    if (is_int($name)) {
                        // No hardcoded params, use the ones from the request
                        $name = $params;
                        $params = $transformation['params'];
                    } else {
                        // Some hardcoded params. Merge with the ones from the request, making the
                        // hardcoded params overwrite the ones from the request
                        $params = array_replace($transformation['params'], $params);
                    }

                    $this->triggerTransformation($name, $params, $event);
                }
            } else {
                // Regular transformation
                $this->triggerTransformation(
                    $transformation['name'],
                    $transformation['params'],
                    $event
                );
            }

            $this->transformationsApplied = true;
        }
    }
public function applyTransformations(EventInterface $event) {
        $request = $event->getRequest();
        $image = $event->getResponse()->getModel();
        $presets = $event->getConfig()['transformationPresets'];

        // Fetch transformations specifed in the query and transform the image
        foreach ($request->getTransformations() as $transformation) {
            if (isset($presets[$transformation['name']])) {
                // Preset
                foreach ($presets[$transformation['name']] as $name => $params) {
                    if (is_int($name)) {
                        // No hardcoded params, use the ones from the request
                        $name = $params;
                        $params = $transformation['params'];
                    } else {
                        // Some hardcoded params. Merge with the ones from the request, making the
                        // hardcoded params overwrite the ones from the request
                        $params = array_replace($transformation['params'], $params);
                    }

                    $this->triggerTransformation($name, $params, $event);
                }
            } else {
                // Regular transformation
                $this->triggerTransformation(
                    $transformation['name'],
                    $transformation['params'],
                    $event
                );
            }

            $this->transformationsApplied = true;
        }
    }
public function applyTransformations ( EventInterface $ event ) { $ request = $ event -> getRequest ( ) ; $ image = $ event -> getResponse ( ) -> getModel ( ) ; $ presets = $ event -> getConfig ( ) [ 'transformationPresets' ] ; // Fetch transformations specifed in the query and transform the image foreach ( $ request -> getTransformations ( ) as $ transformation ) { if ( isset ( $ presets [ $ transformation [ 'name' ] ] ) ) { // Preset foreach ( $ presets [ $ transformation [ 'name' ] ] as $ name => $ params ) { if ( is_int ( $ name ) ) { // No hardcoded params, use the ones from the request $ name = $ params ; $ params = $ transformation [ 'params' ] ; } else { // Some hardcoded params. Merge with the ones from the request, making the // hardcoded params overwrite the ones from the request $ params = array_replace ( $ transformation [ 'params' ] , $ params ) ; } $ this -> triggerTransformation ( $ name , $ params , $ event ) ; } } else { // Regular transformation $ this -> triggerTransformation ( $ transformation [ 'name' ] , $ transformation [ 'params' ] , $ event ) ; } $ this -> transformationsApplied = true ; } }
Apply image transformations

@param EventInterface $event The current event
Apply image transformations