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

resize og image #1712

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/Resources/views/page.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@
<meta property="og:image:height" content="336">
{% else %}
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="{{ absolute_url(asset('assets/images/social/icon-600x600@1.png')) }}">
<meta property="og:image" content="{{ absolute_url(asset('assets/images/social/icon-600x600@1.png')) }}">
<meta property="og:image:width" content="600">
<meta property="og:image:height" content="600">
<meta name="twitter:image" content="{{ absolute_url(asset('assets/images/social/icon-280x200@1.png')) }}">
<meta property="og:image" content="{{ absolute_url(asset('assets/images/social/icon-280x200@1.png')) }}">
<meta property="og:image:width" content="280">
<meta property="og:image:height" content="200">
{% endif %}

{% if contentHeader is defined and contentHeader.meta is defined %}
Expand Down
Binary file modified assets/images/social/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ gulp.task('images:social', ['images:clean'], () => {
return gulp.src('./assets/images/social/*.png')
.pipe(responsive({
'*': [1, 2].reduce((acc, scale) => {
const width = 600 * scale;
const height = 600 * scale;
const width = 280 * scale;
const height = 200 * scale;

acc.push({
width: width,
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutAimsScopeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ public function it_has_metadata()
$this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function it_has_metadata()
$this->assertSame('Independent, not-for-profit and supported by funders, eLife improves the way research is practised and shared.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('Independent, not-for-profit and supported by funders, eLife improves the way research is practised and shared.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutPeerReviewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function it_has_metadata()
$this->assertSame('eLife\'s review process combines the immediacy and openness of preprints with the scrutiny of peer review by experts.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife\'s review process combines the immediacy and openness of preprints with the scrutiny of peer review by experts.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutPeopleControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ public function it_has_metadata()
$this->assertSame('eLife’s editors, early-career advisors, governing board, and executive staff work in concert to realise our mission.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife’s editors, early-career advisors, governing board, and executive staff work in concert to realise our mission.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutPublishingWithElifeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ public function it_has_metadata()
$this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutResearchCultureControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function it_has_metadata()
$this->assertSame('eLife recognises that reforming research communication depends on improving research culture.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife recognises that reforming research communication depends on improving research culture.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AboutTechnologyControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function it_has_metadata()
$this->assertSame('eLife develops and invests in technology that enhances the sharing and use of research results online.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('eLife develops and invests in technology that enhances the sharing and use of research results online.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
8 changes: 4 additions & 4 deletions test/Controller/AlertsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public function it_has_metadata()
$this->assertSame('Stay in touch with eLife efforts to support the community and open science as well as new research. Choose your feeds and preferred ways to connect below.', $crawler->filter('meta[property="og:description"]')->attr('content'));
$this->assertSame('Stay in touch with eLife efforts to support the community and open science as well as new research. Choose your feeds and preferred ways to connect below.', $crawler->filter('meta[name="description"]')->attr('content'));
$this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content'));
$this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-280x200@1.c5b562b1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content'));
$this->assertSame('280', $crawler->filter('meta[property="og:image:width"]')->attr('content'));
$this->assertSame('200', $crawler->filter('meta[property="og:image:height"]')->attr('content'));
$this->assertEmpty($crawler->filter('meta[name="dc.identifier"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]'));
$this->assertEmpty($crawler->filter('meta[name="dc.title"]'));
Expand Down
Loading