feat: add image resize percent

This commit is contained in:
Damillora 2022-04-15 04:19:05 +07:00
parent 2c56336c4f
commit 31763528bf
3 changed files with 13 additions and 5 deletions

View File

@ -56,7 +56,7 @@
<strong>Original:</strong> <strong>Original:</strong>
</div> </div>
<div class="row"> <div class="row">
<a href={post.image_path}>Image</a> <a href={post.image_path} target="_blank">Image</a>
</div> </div>
</div> </div>
<div class="panel-block column"> <div class="panel-block column">

View File

@ -26,7 +26,7 @@
<strong>Original:</strong> <strong>Original:</strong>
</div> </div>
<div class="row"> <div class="row">
<a href={post.image_path}>Image</a> <a href={post.image_path} target="_blank">Image</a>
</div> </div>
</div> </div>
<div class="panel-block column"> <div class="panel-block column">

View File

@ -40,6 +40,13 @@
const toggleEditMenu = () => { const toggleEditMenu = () => {
editMenuShown = !editMenuShown; editMenuShown = !editMenuShown;
}; };
let imagePercentage = "0%";
$: {
if (post)
imagePercentage = ((1000 * 100) / post.width).toFixed(0) + "%";
}
</script> </script>
{#if post} {#if post}
@ -82,8 +89,10 @@
<div class="column box"> <div class="column box">
{#if post.width > 1000} {#if post.width > 1000}
<div class="notification is-info"> <div class="notification is-info">
The image has been resized due to size. The original Resized to {imagePercentage} of the original image.
image link is in the sidebar <a href={post.image_path} target="_blank"
>View original</a
>
</div> </div>
<figure class="image"> <figure class="image">
<img alt={post.id} src={post.preview_path} /> <img alt={post.id} src={post.preview_path} />
@ -97,5 +106,4 @@
</div> </div>
</section> </section>
</div> </div>
{/if} {/if}