@ozdao/prometheus-framework 0.1.22 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +7 -3
- package/dist/gallery.server.mjs +7 -3
- package/package.json +1 -1
- package/src/modules/files/middlewares/server/middlewareMulter.js +1 -2
- package/src/modules/gallery/controllers/gallery.controller.js +4 -2
package/dist/files.server.js
CHANGED
@@ -71,7 +71,7 @@ function requireMiddlewareMulter() {
|
|
71
71
|
};
|
72
72
|
const createThumbnail = async (originalPath, thumbnailPath) => {
|
73
73
|
try {
|
74
|
-
await sharp(originalPath).resize(
|
74
|
+
await sharp(originalPath).resize({ width: 800 }).toFile(thumbnailPath);
|
75
75
|
} catch (error) {
|
76
76
|
console.error("Error creating thumbnail:", error);
|
77
77
|
}
|
package/dist/files.server.mjs
CHANGED
@@ -70,7 +70,7 @@ function requireMiddlewareMulter() {
|
|
70
70
|
};
|
71
71
|
const createThumbnail = async (originalPath, thumbnailPath) => {
|
72
72
|
try {
|
73
|
-
await sharp(originalPath).resize(
|
73
|
+
await sharp(originalPath).resize({ width: 800 }).toFile(thumbnailPath);
|
74
74
|
} catch (error) {
|
75
75
|
console.error("Error creating thumbnail:", error);
|
76
76
|
}
|
package/dist/gallery.server.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-3b53548e.js");
|
3
|
-
require("path");
|
3
|
+
const require$$2 = require("path");
|
4
4
|
const index = require("./index-21dfdbd9.js");
|
5
5
|
require("jsonwebtoken");
|
6
6
|
require("mongodb");
|
7
|
+
const path = require$$2;
|
7
8
|
const controllerFactory$1 = (db) => {
|
8
9
|
const Photo = db.photo;
|
9
10
|
const read = async (req, res) => {
|
@@ -36,11 +37,14 @@ const controllerFactory$1 = (db) => {
|
|
36
37
|
}
|
37
38
|
const photos = [];
|
38
39
|
for (let imageLink of images) {
|
40
|
+
const filename = path.basename(imageLink);
|
39
41
|
const newPhoto = {
|
40
42
|
categories,
|
41
43
|
size,
|
42
|
-
image:
|
43
|
-
|
44
|
+
image: filename,
|
45
|
+
// Теперь сохраняется только имя файла
|
46
|
+
cover: "thumbnail_" + filename
|
47
|
+
// Путь для тумбнейла теперь использует только имя файла
|
44
48
|
};
|
45
49
|
const photo = await Photo.create(newPhoto);
|
46
50
|
if (!photo) {
|
package/dist/gallery.server.mjs
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-83b1d755.mjs";
|
2
|
-
import "path";
|
2
|
+
import require$$2 from "path";
|
3
3
|
import { s as server } from "./index-fa8d5df4.mjs";
|
4
4
|
import "jsonwebtoken";
|
5
5
|
import "mongodb";
|
6
|
+
const path = require$$2;
|
6
7
|
const controllerFactory$1 = (db) => {
|
7
8
|
const Photo = db.photo;
|
8
9
|
const read = async (req, res) => {
|
@@ -35,11 +36,14 @@ const controllerFactory$1 = (db) => {
|
|
35
36
|
}
|
36
37
|
const photos = [];
|
37
38
|
for (let imageLink of images) {
|
39
|
+
const filename = path.basename(imageLink);
|
38
40
|
const newPhoto = {
|
39
41
|
categories,
|
40
42
|
size,
|
41
|
-
image:
|
42
|
-
|
43
|
+
image: filename,
|
44
|
+
// Теперь сохраняется только имя файла
|
45
|
+
cover: "thumbnail_" + filename
|
46
|
+
// Путь для тумбнейла теперь использует только имя файла
|
43
47
|
};
|
44
48
|
const photo = await Photo.create(newPhoto);
|
45
49
|
if (!photo) {
|
package/package.json
CHANGED
@@ -36,14 +36,13 @@ const createStorage = (folderName, publicPath) => {
|
|
36
36
|
const createThumbnail = async (originalPath, thumbnailPath) => {
|
37
37
|
try {
|
38
38
|
await sharp(originalPath)
|
39
|
-
.resize(
|
39
|
+
.resize({ width: 800 })
|
40
40
|
.toFile(thumbnailPath);
|
41
41
|
} catch (error) {
|
42
42
|
console.error("Error creating thumbnail:", error);
|
43
43
|
}
|
44
44
|
};
|
45
45
|
|
46
|
-
|
47
46
|
const middlewareFactory = (db, publicPath) => {
|
48
47
|
const uploadSingleFileMiddleware = async (req, res, next) => {
|
49
48
|
|
@@ -52,11 +52,13 @@ const controllerFactory = (db) => {
|
|
52
52
|
const photos = [];
|
53
53
|
|
54
54
|
for (let imageLink of images) {
|
55
|
+
const filename = path.basename(imageLink);
|
56
|
+
|
55
57
|
const newPhoto = {
|
56
58
|
categories,
|
57
59
|
size,
|
58
|
-
image:
|
59
|
-
cover: 'thumbnail_' +
|
60
|
+
image: filename, // Теперь сохраняется только имя файла
|
61
|
+
cover: 'thumbnail_' + filename, // Путь для тумбнейла теперь использует только имя файла
|
60
62
|
};
|
61
63
|
|
62
64
|
const photo = await Photo.create(newPhoto);
|