Skip to content

Commit

Permalink
Fix : Modify image save button error
Browse files Browse the repository at this point in the history
- #8
  • Loading branch information
carboxaminoo committed Mar 13, 2024
1 parent e5a99d2 commit e57d228
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
15 changes: 10 additions & 5 deletions mz_v1_front/src/components/button/result_save.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<script>
export let targetImage = "target_image_path.jpg";
export let targetImage = "/join/placeholder-image2.svg";
export let fileName = "default";
function downloadImage() {
async function downloadImage() {
const response = await fetch(targetImage);
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = targetImage;
a.download = targetImage.split('/').pop(); // 원하는 파일 이름으로 변경하세요.
a.href = url;
a.download = fileName+"."+targetImage.split('.').pop();
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
}
</script>

<img on:click={downloadImage}
Expand Down
1 change: 0 additions & 1 deletion mz_v1_front/src/routes/infogather/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
formData.append('age', info_age);
formData.append('gender', info_gender);
if (audioBlob) {
console.log(typeof(audioBlob));
formData.append('file', audioBlob, 'svelte_audio.wav');
}
Expand Down
4 changes: 2 additions & 2 deletions mz_v1_front/src/routes/result/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ style="
"
>
<StarRating ABtype='voice' result_id={id} latest_id={latest_id} />
<SaveImage targetImage= {results.voice_image_url}/>
<SaveImage targetImage= {results.voice_image_url} fileName="voice"/>

</div>

Expand Down Expand Up @@ -326,7 +326,7 @@ style="
"
>
<StarRating ABtype= 'condition' result_id={id} latest_id={latest_id}/>
<SaveImage targetImage={results.condition_image_url} />
<SaveImage targetImage={results.condition_image_url} fileName="condition"/>

</div>

Expand Down
4 changes: 4 additions & 0 deletions mz_v1_front/static/join/mic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e57d228

Please sign in to comment.