From 72420a57e5a593833f1fbd7e36fb59975c418357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Mon, 17 Aug 2015 14:02:48 +0200 Subject: [PATCH] Make sure `ezimage` field type handler generates full image URI even when variation returns the relative URI --- Handler/FieldType/Image.php | 9 ++++++++- Resources/doc/CHANGELOG.md | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Handler/FieldType/Image.php b/Handler/FieldType/Image.php index 70aa4aa..bdcfbbd 100644 --- a/Handler/FieldType/Image.php +++ b/Handler/FieldType/Image.php @@ -74,7 +74,14 @@ protected function getFieldValue( Field $field, $tagName, array $params = array( try { - return $this->imageVariationService->getVariation( $field, $this->content->versionInfo, $variationName )->uri; + $variationUri = $this->imageVariationService->getVariation( $field, $this->content->versionInfo, $variationName )->uri; + + if ( $variationUri[0] === '/' && ( $request = $this->requestStack->getCurrentRequest() ) !== null ) + { + $variationUri = $request->getUriForPath( '/' . ltrim( $variationUri, '/' ) ); + } + + return $variationUri; } catch ( InvalidVariationException $e ) { diff --git a/Resources/doc/CHANGELOG.md b/Resources/doc/CHANGELOG.md index f00dea5..5b57ba8 100644 --- a/Resources/doc/CHANGELOG.md +++ b/Resources/doc/CHANGELOG.md @@ -1,6 +1,10 @@ Netgen Open Graph Bundle changelog ================================== +## 1.1.1 (17.08.2015) + +* Make sure `ezimage` field type handler generates full image URI even when variation returns the relative URI + ## 1.1 (15.05.2015) * Implement the ability to define the array of field identifiers to be used in field type handlers