Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Browser: Take Photo on iPhone uploads the picture

Gabriele Lozuponead4153948be8
diff --git a/src/lib/native.ts b/src/lib/native.ts
index 64c63ce..b2d70ce 100644
--- a/src/lib/native.ts
+++ b/src/lib/native.ts
@@ -55,15 +55,23 @@ export const native = {
if (!r) return [];
return Array.isArray(r) ? r : [r];
},
- /** Browser: the images picked on this device, to upload. */
+ /** Browser: the images picked on this device, to upload. The input stays in the page until it
+ * answers: iOS Safari drops a detached one while the Camera is open (Take Photo never came
+ * back; the photo library, quicker, did). */
pickImageFiles: (): Promise<File[]> =>
new Promise((resolve) => {
const input = document.createElement("input");
input.type = "file";
input.multiple = true;
input.accept = "image/*,.heic,.heif";
- input.onchange = () => resolve(Array.from(input.files ?? []));
- input.oncancel = () => resolve([]);
+ input.hidden = true;
+ const done = (files: File[]) => {
+ input.remove();
+ resolve(files);
+ };
+ input.onchange = () => done(Array.from(input.files ?? []));
+ input.oncancel = () => done([]);
+ document.body.appendChild(input);
input.click();
}),
pickFile: async (extensions: string[], defaultPath?: string, kind = "Model"): Promise<string | null> => {