fix the image preview display

This commit is contained in:
caranicas 2022-09-14 17:56:38 -04:00
parent 4979e176c7
commit 37592a876e
5 changed files with 21 additions and 10 deletions

View File

@ -1,3 +1,7 @@
input[size="4"] {
width: 4.5rem;
}
#File-Body>#File-For {
display: none;
}

View File

@ -46,3 +46,8 @@ li {
.modifierTag p {
margin: 0;
}
input[type="file"] {
/* Dont show the file name */
color:transparent;
}

View File

@ -32,6 +32,7 @@ export default function CreationPanel() {
const reader = new FileReader();
reader.onload = (e) => {
if (e.target) {
debugger;
setRequestOption("init_image", e.target.result);
}
};
@ -39,6 +40,10 @@ export default function CreationPanel() {
}
};
const _handleClearImage = () => {
setRequestOption("init_image", undefined);
};
return (
<div className="create-panel">
<div className="basic-create">
@ -47,11 +52,6 @@ export default function CreationPanel() {
<textarea value={promptText} onChange={handlePromptChange}></textarea>
</div>
{/* <div className="seed-image">
<p>Seed Image</p>
<input type="file" accept="image/*" />
</div> */}
<div id="editor-inputs-init-image" className="row">
<label>
<b>Initial Image:</b> (optional){" "}
@ -63,19 +63,21 @@ export default function CreationPanel() {
onChange={_handleFileSelect}
/>
<br />
{init_image && (
<div id="init_image_preview" className="image_preview">
{init_image && (
<img
id="init_image_preview"
src={init_image}
width="100"
height="100"
/>
)}
<button id="init_image_clear" className="image_clear_btn">
<button id="init_image_clear" className="image_clear_btn" onClick={_handleClearImage}>
X
</button>
</div>
)}
</div>
<MakeButton></MakeButton>

View File

@ -58,8 +58,8 @@ export default function GeneratedImage({
};
const _handleUseAsInput = () => {
console.log(" TODO : use as input");
debugger;
setRequestOption("init_image", imageData);
// initImageSelector.value = null
// initImagePreview.src = imgBody

View File

@ -202,7 +202,7 @@ export const useImageCreate = create<ImageCreateState>(
isCheckUseFaceCorrection: true,
isUseRandomSeed: true,
isUseAutoSave: false,
isSoundEnabled: true,
isSoundEnabled: false,
},
toggleAdvancedSettingsIsOpen: () => {