Revert: Resize images before upload in web UI to reduce bandwidth
Closes: https://git.pleroma.social/pleroma/mastofe/issues/22 (Can also fix an issue with canvas and the Tor Browser)
This commit is contained in:
parent
c0a0acbb6c
commit
1797752d02
1 changed files with 11 additions and 8 deletions
|
@ -4,7 +4,6 @@ import { throttle } from 'lodash';
|
|||
import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light';
|
||||
import { tagHistory } from '../settings';
|
||||
import { useEmoji } from './emojis';
|
||||
import resizeImage from '../utils/resize_image';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
import { updateTimeline } from './timelines';
|
||||
import { showAlertForError } from './alerts';
|
||||
|
@ -190,14 +189,18 @@ export function uploadCompose(files) {
|
|||
|
||||
dispatch(uploadComposeRequest());
|
||||
|
||||
resizeImage(files[0]).then(file => {
|
||||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
let data = new FormData();
|
||||
data.append('file', files[0]);
|
||||
|
||||
return api(getState).post('/api/v1/media', data, {
|
||||
onUploadProgress: ({ loaded, total }) => dispatch(uploadComposeProgress(loaded, total)),
|
||||
}).then(({ data }) => dispatch(uploadComposeSuccess(data)));
|
||||
}).catch(error => dispatch(uploadComposeFail(error)));
|
||||
api(getState).post('/api/v1/media', data, {
|
||||
onUploadProgress: function (e) {
|
||||
dispatch(uploadComposeProgress(e.loaded, e.total));
|
||||
},
|
||||
}).then(function (response) {
|
||||
dispatch(uploadComposeSuccess(response.data));
|
||||
}).catch(function (error) {
|
||||
dispatch(uploadComposeFail(error));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue