[FIX] Avatar fonts for PNG and JPG (#13681)

pull/13486/head
Diego Sampaio 6 years ago committed by GitHub
parent c4bc2349e0
commit eeb57a1f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 328
      package-lock.json
  2. 2
      package.json
  3. 2
      server/startup/avatar.js

328
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -206,7 +206,7 @@
"queue-fifo": "^0.2.5",
"redis": "^2.8.0",
"semver": "^5.6.0",
"sharp": "^0.21.0",
"sharp": "^0.21.3",
"speakeasy": "^2.0.0",
"stream-buffers": "^3.0.2",
"subscriptions-transport-ws": "^0.9.11",

@ -141,7 +141,7 @@ Meteor.startup(function() {
const viewSize = parseInt(req.query.size) || 200;
const fontSize = viewSize / 1.6;
const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${ viewSize } ${ viewSize }\">\n<rect width=\"100%\" height=\"100%\" fill=\"${ color }\"/>\n<text x=\"50%\" y=\"50%\" dy=\"0.36em\" text-anchor=\"middle\" pointer-events=\"none\" fill=\"#ffffff\" font-family=\"Helvetica, Arial, Lucida Grande, sans-serif\" font-size="${ fontSize }">\n${ initials }\n</text>\n</svg>`;
const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${ viewSize } ${ viewSize }\">\n<rect width=\"100%\" height=\"100%\" fill=\"${ color }\"/>\n<text x=\"50%\" y=\"50%\" dy=\"0.36em\" text-anchor=\"middle\" pointer-events=\"none\" fill=\"#ffffff\" font-family=\"'Helvetica', 'Arial', 'Lucida Grande', 'sans-serif'\" font-size="${ fontSize }">\n${ initials }\n</text>\n</svg>`;
if (['png', 'jpg', 'jpeg'].includes(req.query.format)) {
res.setHeader('Content-Type', `image/${ req.query.format }`);

Loading…
Cancel
Save