Skip to content

Commit

Permalink
fix image link and support webp images
Browse files Browse the repository at this point in the history
  • Loading branch information
wi-wissen committed Jan 10, 2025
1 parent 7e63798 commit 239ee4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/views/admin/partials/result-table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if (value === null) return 'null';
if (typeof value === 'string') {
if (value.match(/^https?:\/\/[^\s]+$/)) return 'url';
if (value.match(/^.*\.(jpg|jpeg|png|gif)$/i)) return 'image';
if (value.match(/^[a-zA-Z0-9-_/.]+\.(jpg|jpeg|png|gif|webp)$/i)) return 'image';
}
return 'text';
}
Expand All @@ -26,10 +26,10 @@
<code>NULL</code>
</template>
<template x-if="getValueType(value) === 'url'">
<a :href="`${encodeURIComponent(value)}`" x-text="value"></a>
<a :href="`${encodeURI(value)}`" x-text="value"></a>
</template>
<template x-if="getValueType(value) === 'image'">
<a :href="`/${encodeURIComponent(value)}`" x-text="value"></a>
<a :href="`/${encodeURI(value)}`" x-text="value"></a>
</template>
<template x-if="getValueType(value) === 'text'">
<span x-text="value"></span>
Expand Down

0 comments on commit 239ee4d

Please sign in to comment.