Skip to content

Commit

Permalink
404 Image error
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Jan 13, 2019
1 parent dd01752 commit 87a3a25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Binary file added client/src/assets/404-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions client/src/components/cards/DatasetCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="card mb-4 box-shadow">

<!-- Display Image -->
<img @click="onImageClick" :src="imageUrl" class="card-img-top" style="width: 100%; display: block;">
<img @click="onImageClick" :src="imageUrl" class="card-img-top" @error="imageError = true" style="width: 100%; display: block;">

<!-- Card Body -->
<div class="card-body">
Expand Down Expand Up @@ -157,9 +157,11 @@ export default {
},
data() {
return {
imageError: false,
selectedCategories: [],
defaultMetadata: this.dataset.default_annotation_metadata,
noImageUrl: require("@/assets/no-image.png"),
notFoundImageUrl: require("@/assets/404-image.png"),
sharedUsers: this.dataset.users
};
},
Expand Down Expand Up @@ -229,11 +231,14 @@ export default {
return 100 * (this.dataset.numberAnnotated / this.dataset.numberImages);
},
imageUrl() {
if (this.imageError) {
return this.notFoundImageUrl;
}
if (this.dataset.numberImages > 0) {
return "/api/image/" + this.dataset.first_image_id + "?width=250";
} else {
return this.noImageUrl;
}
return this.noImageUrl;
},
listCategories() {
let list = [];
Expand Down

0 comments on commit 87a3a25

Please sign in to comment.