Skip to content

Commit

Permalink
domains: fix 500px
Browse files Browse the repository at this point in the history
  • Loading branch information
iparamonau committed Oct 28, 2024
1 parent 66a6ef9 commit e7b0483
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions plugins/domains/500px/500px.com.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ export default {

mixins: ["*"],

getLinks: function(urlMatch, twitter) {
if (twitter.card === 'photo' && twitter.image) {
return {
template_context: {
title: twitter.title + ' | ' + twitter.site,
img_src: twitter.image.src,
id: urlMatch[1]
},
type: CONFIG.T.text_html,
rel: [CONFIG.R.image, CONFIG.R.ssl, CONFIG.R.inline],
"aspect-ratio": twitter.image.height ? twitter.image.width / twitter.image.height : null
}
getLinks: function(urlMatch, twitter, utils, options, cb) {
if (twitter.image) {
utils.getImageMetadata(twitter.image, options, function(error, data) {
if (data.width && data.height) {
return cb(null, {
template_context: {
title: twitter.title + ' | ' + twitter.site,
img_src: twitter.image,
id: urlMatch[1]
},
type: CONFIG.T.text_html,
rel: [CONFIG.R.image, CONFIG.R.ssl, CONFIG.R.inline],
"aspect-ratio": data.width / data.height
})
} else {
return cb();
}
});
} else {
return cb();
}
},

Expand Down

0 comments on commit e7b0483

Please sign in to comment.