Skip to content

Commit

Permalink
Fix retrieving images
Browse files Browse the repository at this point in the history
  • Loading branch information
dguo committed Feb 21, 2021
1 parent 34a9dc4 commit 5b99882
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.6.2] - 2021-02-21

### Fixed

- Fix retrieving images.

## [0.6.1] - 2019-11-03

### Fixed
Expand Down Expand Up @@ -89,7 +95,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Initial implementation

[Unreleased]: https://github.com/dguo/picture-paint/compare/v0.6.1...HEAD
[Unreleased]: https://github.com/dguo/picture-paint/compare/v0.6.2...HEAD
[0.6.2]: https://github.com/dguo/picture-paint/compare/v0.6.1...v0.6.2
[0.6.1]: https://github.com/dguo/picture-paint/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/dguo/picture-paint/compare/v0.5.2...v0.6.0
[0.5.2]: https://github.com/dguo/picture-paint/compare/v0.5.1...v0.5.2
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Picture Paint",
"version": "0.6.1",
"version": "0.6.2",
"author": "Danny Guo",
"homepage_url": "https://github.com/dguo/picture-paint",
"applications": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "picture-paint",
"version": "0.6.1",
"version": "0.6.2",
"description": "Dynamic Firefox theme",
"homepage": "https://github.com/dguo/picture-paint",
"bugs": "https://github.com/dguo/picture-paint/issues",
Expand Down
10 changes: 7 additions & 3 deletions src/paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ async function getNatGeoPhoto(date) {
console.log(photo);
}

const splitUri = photo.image.uri.split("/");
const imageUrl = `https://i.natgeofe.com/n/${photo.image.id}/${
splitUri[splitUri.length - 1]
}`;

const details = {
altText: photo.image.alt_text,
caption: photo.image.caption,
credit: photo.image.credit,
smallImageUrl: photo.image.renditions[0].uri,
largeImageUrl:
photo.image.renditions[photo.image.renditions.length - 1].uri,
smallImageUrl: `${imageUrl}?w=200`,
largeImageUrl: `${imageUrl}?w=1000`,
pageUrl: photo.pageUrl,
publishDate: moment(photo.publishDate, "MMMM D, Y").format(
"YYYY-MM-DD"
Expand Down

0 comments on commit 5b99882

Please sign in to comment.