Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 54c46f6

Browse files
committed
Allow both jpg and jpeg as possible file formats
I initially intended to simply correct the README, pointing out that the correct option is 'jpeg' and not 'jpg', but allowing both seems friendlier
1 parent a6a419a commit 54c46f6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ plotly.getFigure('fileOwner', 'fileId', function (err, figure) {
172172

173173
## plotly.getImage(figure[, options, callback])
174174
`figure` is a JSON object of the graph figure
175-
`options.format` | `jpg`, `png`, `pdf`, `eps`, `webp`
175+
`options.format` | `jpg`, `jpeg`, `png`, `pdf`, `eps`, `webp`
176176
`options.width` | width in `px` (default : 700)
177177
`options.height` | height in `px` (default : 500)
178178

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ Plotly.prototype.getImage = function (figure, opts, callback) {
207207
if (!figure) return new Error('no figure provided!');
208208

209209
var self = this;
210+
211+
// allow both jpg and jpeg as file formats
212+
if (opts && opts.format === 'jpg') opts.format = 'jpeg';
213+
210214
var payload = JSON.stringify({
211215
figure: figure,
212216
format: opts.format || 'png',

0 commit comments

Comments
 (0)