-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OPENEUROPA-2025: Use custom image effect to prevent retina image reducction. #254
Conversation
f4695ba
to
be92032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And no tests? See ImageEffectsTest
modules/oe_theme_helper/config/schema/oe_theme_helper.schema.yml
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/templates/retina-image-scale-summary.html.twig
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Show resolved
Hide resolved
b09371e
to
54628cf
Compare
modules/oe_theme_helper/config/schema/oe_theme_helper.schema.yml
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try moving everything directly into the theme rather than the module?
modules/oe_theme_helper/src/Plugin/ImageEffect/RetinaScaleImageEffect.php
Outdated
Show resolved
Hide resolved
modules/oe_theme_helper/tests/src/Functional/RetinaScaleEffectTest.php
Outdated
Show resolved
Hide resolved
c44da91
to
38c43d8
Compare
} | ||
|
||
/** | ||
* Test the retina_image_scale_effect() function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What function is this?
*/ | ||
public function testRetinaScaleEffect(): void { | ||
$this->assertImageEffect('retina_image_scale', [ | ||
// Set the desired width to be much higher than the image width. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. By default, it uses a multiplier of 2.
]); | ||
$this->assertToolkitOperationsCalled(['scale']); | ||
|
||
// Check the parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this comment.
} | ||
|
||
/** | ||
* Test the image_scale_effect() function using a multiplier of 3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What function?
$this->assertImageEffect('retina_image_scale', [ | ||
// Set the desired width to be much higher than the image width. | ||
'width' => $this->image->getWidth() * 10, | ||
// Set a multiplier of three for the test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this comment.
* Test the image_scale_effect() function using a big enough image. | ||
*/ | ||
public function testScaleEffect(): void { | ||
$this->assertImageEffect('image_scale', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we testing the image_scale
effect or the retina_image_scale
effect?
} | ||
|
||
/** | ||
* Test the image_scale_effect() function using upscaling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, copy paste from core I see...
* Test the image_scale_effect() function using upscaling. | ||
*/ | ||
public function testScaleEffectWithUpscaling(): void { | ||
$this->assertImageEffect('image_scale', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we testing here?
], | ||
'#default_value' => $this->configuration['multiplier'], | ||
'#required' => TRUE, | ||
'#description' => $this->t("The image will be upscaled according to this multiplier if it is smaller than the dimensions defined in the 'Width' and 'Height' properties."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single quotes.
Also we should mention that it only gets upscaled if the upscale
is not unchecked no?
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setUp
is not ours so we shouldn't really put the void.
OPENEUROPA-2025
Description
When the images we use are too small, the same image is used for both regular and retina displays. This means that on retina displays the image gets displayed at half size.
Fix the issue by upscaling the image if it is smaller than the desired scale.
Change log
Commands