Skip to content
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

Merged
merged 16 commits into from
Jul 8, 2019

Conversation

imanoleguskiza
Copy link
Member

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

  • Added: Custom retina scale effect
  • Changed:
  • Deprecated:
  • Removed:
  • Fixed:
  • Security:

Commands

[Insert commands here]

@imanoleguskiza imanoleguskiza force-pushed the OPENEUROPA-2025 branch 4 times, most recently from f4695ba to be92032 Compare July 1, 2019 13:49
Copy link
Contributor

@upchuk upchuk left a 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

Copy link
Contributor

@upchuk upchuk left a 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?

}

/**
* Test the retina_image_scale_effect() function.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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', [
Copy link
Contributor

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.
Copy link
Contributor

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', [
Copy link
Contributor

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."),
Copy link
Contributor

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 {
Copy link
Contributor

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.

@imanoleguskiza imanoleguskiza merged commit eb2582f into master Jul 8, 2019
@imanoleguskiza imanoleguskiza deleted the OPENEUROPA-2025 branch July 8, 2019 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants