adminizer 4.3.0-build.109 → 4.3.0-build.110

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.
@@ -106,7 +106,7 @@ export class MediaManagerAdapter {
106
106
  });
107
107
  }
108
108
  checkDirectory() {
109
- const outputDir = `${this.manager.fileStoragePath}/${this.manager.urlPathPrefix}`;
109
+ const outputDir = `${process.cwd()}/${this.manager.fileStoragePath}/${this.manager.urlPathPrefix}`;
110
110
  if (!fs.existsSync(outputDir)) {
111
111
  fs.mkdirSync(outputDir, { recursive: true });
112
112
  }
@@ -4,6 +4,7 @@ import sizeOf from "image-size";
4
4
  import sharp from "sharp";
5
5
  import * as fs from 'fs';
6
6
  import * as path from 'path';
7
+ import * as process from "node:process";
7
8
  export class ImageItem extends File {
8
9
  type = "image";
9
10
  model = "mediamanagerap";
@@ -55,7 +56,7 @@ export class ImageItem extends File {
55
56
  parent: null,
56
57
  mimeType: file.mimetype,
57
58
  size: file.size,
58
- path: file.path,
59
+ path: `${this.fileStoragePath}/${this.urlPathPrefix}/${filename}`,
59
60
  group: group,
60
61
  tag: "origin",
61
62
  filename: origFileName,
@@ -148,7 +149,7 @@ export class ImageItem extends File {
148
149
  }
149
150
  async resizeImage(input, output, width, height) {
150
151
  // Get the directory from the output path
151
- const outputDir = path.dirname(output);
152
+ const outputDir = `${process.cwd()}/${path.dirname(output)}`;
152
153
  // Check if the directory exists, and create it if it doesn't
153
154
  if (!fs.existsSync(outputDir)) {
154
155
  fs.mkdirSync(outputDir, { recursive: true });
@@ -209,7 +210,7 @@ export class TextItem extends ImageItem {
209
210
  parent: null,
210
211
  mimeType: file.mimetype,
211
212
  size: file.size,
212
- path: file.path,
213
+ path: `${this.fileStoragePath}/${filename}`,
213
214
  group: group,
214
215
  filename: origFileName,
215
216
  tag: "origin",
@@ -12,7 +12,7 @@ export class MediaManagerThumb {
12
12
  return await fs.readFile(thumb);
13
13
  }
14
14
  else {
15
- await sharp(path)
15
+ await sharp(`${process.cwd()}/${path}`)
16
16
  .resize({ width: 150, height: 150 })
17
17
  .toFile(thumb);
18
18
  return await fs.readFile(thumb);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.109",
4
+ "version": "4.3.0-build.110",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
@@ -140,6 +140,9 @@ let adminpanelConfig = {
140
140
  },
141
141
  notifications: {
142
142
  enabled: false
143
+ },
144
+ mediamanager: {
145
+ fileStoragePath: '.tmp/public',
143
146
  }
144
147
  };
145
148
  export function setDefaultConfig(config) {