@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.
@@ -71,7 +71,7 @@ function requireMiddlewareMulter() {
71
71
  };
72
72
  const createThumbnail = async (originalPath, thumbnailPath) => {
73
73
  try {
74
- await sharp(originalPath).resize(200).toFile(thumbnailPath);
74
+ await sharp(originalPath).resize({ width: 800 }).toFile(thumbnailPath);
75
75
  } catch (error) {
76
76
  console.error("Error creating thumbnail:", error);
77
77
  }
@@ -70,7 +70,7 @@ function requireMiddlewareMulter() {
70
70
  };
71
71
  const createThumbnail = async (originalPath, thumbnailPath) => {
72
72
  try {
73
- await sharp(originalPath).resize(200).toFile(thumbnailPath);
73
+ await sharp(originalPath).resize({ width: 800 }).toFile(thumbnailPath);
74
74
  } catch (error) {
75
75
  console.error("Error creating thumbnail:", error);
76
76
  }
@@ -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: imageLink,
43
- cover: "thumbnail_" + imageLink
44
+ image: filename,
45
+ // Теперь сохраняется только имя файла
46
+ cover: "thumbnail_" + filename
47
+ // Путь для тумбнейла теперь использует только имя файла
44
48
  };
45
49
  const photo = await Photo.create(newPhoto);
46
50
  if (!photo) {
@@ -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: imageLink,
42
- cover: "thumbnail_" + imageLink
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Web3 Framework focused on user experience and ease of development.",
5
5
  "author": "OZ DAO <hello@ozdao.dev>",
6
6
  "license": "GPL-3.0-or-later",
@@ -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(200)
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: imageLink,
59
- cover: 'thumbnail_' + imageLink,
60
+ image: filename, // Теперь сохраняется только имя файла
61
+ cover: 'thumbnail_' + filename, // Путь для тумбнейла теперь использует только имя файла
60
62
  };
61
63
 
62
64
  const photo = await Photo.create(newPhoto);