aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-03-24 10:06:14 -0400
committerbobzel <zzzman@gmail.com>2022-03-24 10:06:14 -0400
commitd21354fefc9f5b343e51c4db67e0bae7d0c187ee (patch)
tree16d9366aa1e55d648e4d2e5256406e91e9b9faf0 /src
parent70cd320fb02993b2abb17dcfb2a3fd1dfefabb36 (diff)
fixing data_url uploading to have a no suffix option.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/PropertiesButtons.tsx4
-rw-r--r--src/client/views/nodes/VideoBox.tsx7
-rw-r--r--src/client/views/nodes/WebBox.tsx4
3 files changed, 11 insertions, 4 deletions
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index dd6448654..24857d8ee 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -102,9 +102,9 @@ export class PropertiesButtons extends React.Component<{}, {}> {
else {
document.body.focus(); // so that we can access the clipboard without an error
setTimeout(() =>
- pasteImageBitmap((data: any, error: any) => {
+ pasteImageBitmap((data_url: any, error: any) => {
error && console.log(error);
- data && VideoBox.convertDataUri(data, doc[Id] + "-thumb-frozen", true).then(
+ data_url && VideoBox.convertDataUri(data_url, doc[Id] + "-thumb-frozen", true).then(
returnedfilename => doc["thumb-frozen"] = new ImageField(returnedfilename));
}));
}
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 33fdc4935..5019d5691 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -252,6 +252,13 @@ export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp
}
}
+ /**
+ * Uploads an image buffer to the server and stores with specified filename. by default the image
+ * is stored at multiple resolutions each retrieved by using the filename appended with _o, _s, _m, _l (indicating original, small, medium, or large)
+ * @param imageUri the bytes of the image
+ * @param returnedFilename the base filename to store the image on the server
+ * @param nosuffix optionally suppress creating multiple resolution images
+ */
public static async convertDataUri(imageUri: string, returnedFilename: string, nosuffix = false) {
try {
const posting = Utils.prepend("/uploadURI");
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 7969546c5..e6acddf23 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -144,8 +144,8 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
nativeWidth * this.props.PanelHeight() / this.props.PanelWidth(),
NumCast(this.layoutDoc._scrollTop)
).then
- ((dataUrl: any) => {
- VideoBox.convertDataUri(dataUrl, this.layoutDoc[Id] + "-thumb" + (new Date()).getTime(), true).then(
+ ((data_url: any) => {
+ VideoBox.convertDataUri(data_url, this.layoutDoc[Id] + "-thumb" + (new Date()).getTime(), true).then(
returnedfilename => setTimeout(action(() => this.layoutDoc.thumb = new ImageField(returnedfilename)), 500));
})
.catch(function (error: any) {