Skip to content

Commit

Permalink
Merge pull request #268 from ymaheshwari1/#266
Browse files Browse the repository at this point in the history
Fixed: issue in image component to render the apps local images correctly(#266)
  • Loading branch information
ymaheshwari1 authored Feb 29, 2024
2 parents 6f24589 + 2b0943d commit 9b5f091
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/DxpImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ let resourceUrl = process.env.VUE_APP_RESOURCE_URL || "";
const setImageUrl = () => {
if (props.src) {
if (props.src.indexOf('assets/') != -1) {
// Assign directly in case of assets
imageUrl.value = props.src;
} else if (props.src.startsWith('http')) {
if (props.src.startsWith('http')) {
// If starts with http, it is web url check for existence and assign
checkIfImageExists(props.src).then(() => {
imageUrl.value = props.src;
}).catch(() => {
console.error("Image doesn't exist");
})
} else if (props.src.indexOf('assets/') != -1 || props.src.startsWith('/img/')) {
// Assign directly in case of assets or if image starts with /img/ (when url start with /img/ then the img is the local asset url of the app)
imageUrl.value = props.src;
} else {
// Image is from resource server, hence append to base resource url, check for existence and assign
const newImageUrl = resourceUrl.concat(props.src)
Expand Down

0 comments on commit 9b5f091

Please sign in to comment.