@live-change/image-service 0.3.14 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/endpoint.js +9 -9
  2. package/package.json +4 -4
package/endpoint.js CHANGED
@@ -86,7 +86,7 @@ async function handleImageGet(req, res, params) {
86
86
  res.send("Bad parameter value")
87
87
  return
88
88
  }
89
- if(width >= metadata.original.width) return res.sendFile(sourceFilePath)
89
+ if(width >= metadata.width) return res.sendFile(sourceFilePath)
90
90
  const normalized = normalizeFormat(params.format || metadata.extension)
91
91
  const convertedFilePath = path.resolve(imagePrefix + `width-${width}.${normalized}`)
92
92
  if(!(await fileExists(convertedFilePath))) {
@@ -106,7 +106,7 @@ async function handleImageGet(req, res, params) {
106
106
  res.send("Bad parameter value")
107
107
  return
108
108
  }
109
- if(height >= metadata.original.height) return res.sendFile(sourceFilePath)
109
+ if(height >= metadata.height) return res.sendFile(sourceFilePath)
110
110
  const normalized = normalizeFormat(params.format || metadata.extension)
111
111
  const convertedFilePath = path.resolve(imagePrefix + `height-${height}.${normalized}`)
112
112
  if(!(await fileExists(convertedFilePath))) {
@@ -127,15 +127,15 @@ async function handleImageGet(req, res, params) {
127
127
  res.send("Bad parameter value")
128
128
  return
129
129
  }
130
- if(height > metadata.original.height) {
131
- width = Math.round(width * metadata.original.height / height)
132
- height = metadata.original.height
130
+ if(height > metadata.height) {
131
+ width = Math.round(width * metadata.height / height)
132
+ height = metadata.height
133
133
  }
134
- if(width > metadata.original.width) {
135
- height = Math.round(height * metadata.original.width / width)
136
- width = metadata.original.width
134
+ if(width > metadata.width) {
135
+ height = Math.round(height * metadata.width / width)
136
+ width = metadata.width
137
137
  }
138
- if(width == metadata.original.width && height == metadata.original.height) return res.sendFile(sourceFilePath)
138
+ if(width == metadata.width && height == metadata.height) return res.sendFile(sourceFilePath)
139
139
  const normalized = normalizeFormat(params.format || metadata.extension)
140
140
  const convertedFilePath = path.resolve(imagePrefix + `rect-${width}-${height}.${normalized}`)
141
141
  if(!(await fileExists(convertedFilePath))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/image-service",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,11 +21,11 @@
21
21
  "url": "https://www.viamage.com/"
22
22
  },
23
23
  "dependencies": {
24
- "@live-change/framework": "0.7.12",
25
- "@live-change/relations-plugin": "0.7.12",
24
+ "@live-change/framework": "0.7.16",
25
+ "@live-change/relations-plugin": "0.7.16",
26
26
  "download": "^8.0.0",
27
27
  "pluralize": "8.0.0",
28
28
  "sharp": "^0.30.6"
29
29
  },
30
- "gitHead": "ef7bce138d9c1492ca84cba6dea2c336c319217e"
30
+ "gitHead": "5270a5144fd43f1e87d91f3dd4349d72efb957fa"
31
31
  }