Compare commits

..

No commits in common. "be331343e7edda2f984f101e954442fe484666c7" and "94848e505fe7c1d13017cc39199602fdac721ed2" have entirely different histories.

3 changed files with 7 additions and 11 deletions

View File

@ -114,6 +114,7 @@ div:has(.placeholder){
width: min(1000px, 100dvw); width: min(1000px, 100dvw);
height: max(60dvh,600px); height: max(60dvh,600px);
overflow: hidden; overflow: hidden;
cursor:zoom-in;
} }
.unblur#image{ .unblur#image{
filter: blur(0px) !important; filter: blur(0px) !important;
@ -151,14 +152,11 @@ dialog button{
top: -2rem; top: -2rem;
right: -2rem; right: -2rem;
} }
.zoom-in{
cursor: zoom-in;
}
</style> </style>
<section class="section"> <section class="section">
<figure class="image-container"> <figure class="image-container">
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class:zoom-in={isloaded} on:click={show_dialog_img}> <div on:click={show_dialog_img}>
<div class=placeholder style="background-image:url({placeholder_src})" > <div class=placeholder style="background-image:url({placeholder_src})" >
<div class=placeholder_blur> <div class=placeholder_blur>
<img class:unblur={isloaded} id=image {src} on:load={() => {isloaded=true}} alt=""/> <img class:unblur={isloaded} id=image {src} on:load={() => {isloaded=true}} alt=""/>

View File

@ -10,7 +10,7 @@ export const POST = (async ({ request }) => {
if(data.bearer === BEARER_TOKEN){ if(data.bearer === BEARER_TOKEN){
[ "full", "thumb", "placeholder"].forEach((folder) => { [ "full", "thumb", "placeholder"].forEach((folder) => {
unlink(path.join(IMAGE_DIR, "rezepte", folder, data.name + ".webp"), (e) => { unlink(path.join(IMAGE_DIR, "rezepte", folder, data.name + ".webp"), (e) => {
if(e) error(404, "could not delete: " + folder + "/" + data.name + ".webp" + e) if(e) throw error(500, "could not delete: " + folder + "/" + data.name + ".webp")
}) })
}) })
return new Response(JSON.stringify({msg: "Deleted image successfully"}),{ return new Response(JSON.stringify({msg: "Deleted image successfully"}),{

View File

@ -136,12 +136,10 @@
// two cases: // two cases:
//new image uploaded (not implemented yet) //new image uploaded (not implemented yet)
// new short_name -> move images as well // new short_name -> move images as well
// if new image // if new image
console.log("img_local", img_local)
if(img_local != ""){ if(img_local != ""){
async function delete_img(){ async function delete_img(){
const res = await fetch('/api/img/delete', { const res_img = await fetch('/api/img/delete', {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
name: old_short_name, name: old_short_name,
@ -152,8 +150,8 @@
bearer: password bearer: password
} }
}) })
if(!res.ok){ if(!res_img.ok){
const item = await res.json(); const item = await res_img.json();
alert(item.message) alert(item.message)
} }
} }
@ -173,7 +171,7 @@
body: JSON.stringify(data) body: JSON.stringify(data)
}); });
if(!res.ok){ if(!res.ok){
const item = await res.json(); const item = await res_img.json();
alert(item.message) alert(item.message)
} }
} }