mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-13 07:45:02 -05:00
feat(ui): support resize_to when uploading images
This commit is contained in:
@@ -270,12 +270,15 @@ export const imagesApi = api.injectEndpoints({
|
||||
},
|
||||
}),
|
||||
uploadImage: build.mutation<ImageDTO, UploadImageArg>({
|
||||
query: ({ file, image_category, is_intermediate, session_id, board_id, crop_visible, metadata }) => {
|
||||
query: ({ file, image_category, is_intermediate, session_id, board_id, crop_visible, metadata, resize_to }) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (metadata) {
|
||||
formData.append('metadata', JSON.stringify(metadata));
|
||||
}
|
||||
if (resize_to) {
|
||||
formData.append('resize_to', JSON.stringify(resize_to));
|
||||
}
|
||||
return {
|
||||
url: buildImagesUrl('upload'),
|
||||
method: 'POST',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Dimensions } from 'features/controlLayers/store/types';
|
||||
import type { components, paths } from 'services/api/schema';
|
||||
import type { JsonObject, SetRequired } from 'type-fest';
|
||||
|
||||
@@ -373,6 +374,10 @@ export type UploadImageArg = {
|
||||
* Whether this is the first upload of a batch (used when displaying user feedback with toasts - ignored if the upload is silent)
|
||||
*/
|
||||
isFirstUploadOfBatch?: boolean;
|
||||
/**
|
||||
* If provided, the uploaded image will resized to the given dimensions.
|
||||
*/
|
||||
resize_to?: Dimensions;
|
||||
};
|
||||
|
||||
export type ImageUploadEntryResponse = S['ImageUploadEntry'];
|
||||
|
||||
Reference in New Issue
Block a user