-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uploading images to ThirdWeb instead of Spheron
- Loading branch information
1 parent
3e35116
commit 5b3beb1
Showing
21 changed files
with
631 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<div> | ||
<img @load="loading=false" :src="parseImageLink" @error="handleLoadError" :alt="alt" :class="cls" /> | ||
<div class="d-flex justify-content-center"> | ||
<span v-if="loading" class="spinner-grow spinner-grow-lg" role="status" aria-hidden="true"></span> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "Image", | ||
props: ["alt", "cls", "url"], | ||
data() { | ||
return { | ||
cid: null, | ||
imageUrl: null, | ||
loading: true, | ||
}; | ||
}, | ||
mounted() { | ||
this.fetchImageData(); | ||
}, | ||
computed: { | ||
parseImageLink() { | ||
let parsedImage = this.imageUrl; | ||
if (parsedImage && parsedImage.includes("ipfs://")) { | ||
parsedImage = parsedImage.replace("ipfs://", this.$config.ipfsGateway); | ||
} | ||
return parsedImage; | ||
}, | ||
}, | ||
methods: { | ||
fetchImageData() { | ||
this.imageUrl = this.url; | ||
if (this.url) { | ||
if (this.url.startsWith(this.$config.ipfsGateway)) { | ||
this.cid = this.url.replace(this.$config.ipfsGateway, ""); | ||
} else if (this.url.startsWith(this.$config.ipfsGateway2)) { | ||
this.cid = this.url.replace(this.$config.ipfsGateway2, ""); | ||
} else if (this.url.startsWith(this.$config.ipfsGateway3)) { | ||
this.cid = this.url.replace(this.$config.ipfsGateway3, ""); | ||
} else if (this.url.startsWith("https://cloudflare-ipfs.com/ipfs/")) { | ||
this.cid = this.url.replace("https://cloudflare-ipfs.com/ipfs/", ""); | ||
} else if (this.url.startsWith("https://ipfs.io/ipfs/")) { | ||
this.cid = this.url.replace("https://ipfs.io/ipfs/", ""); | ||
} else if (this.url.startsWith("ipfs://")) { | ||
this.cid = this.url.replace("ipfs://", ""); | ||
} else if (this.url.startsWith("https://ipfs.itslit.org/ipfs/")) { | ||
this.cid = this.url.replace("https://ipfs.itslit.org/ipfs/", ""); | ||
} else if (this.url.startsWith("https://ipfs.dylmusic.com/ipfs/")) { | ||
this.cid = this.url.replace("https://ipfs.dylmusic.com/ipfs/", ""); | ||
} | ||
} | ||
}, | ||
handleLoadError() { | ||
if (this.cid) { | ||
if (this.imageUrl.startsWith(this.$config.ipfsGateway)) { | ||
return this.imageUrl = this.$config.ipfsGateway3 + this.cid; | ||
} else if (this.imageUrl.startsWith(this.$config.ipfsGateway3)) { | ||
return this.imageUrl = this.$config.ipfsGateway2 + this.cid; | ||
} | ||
} | ||
this.imageUrl = "https://placeholder.pics/svg/300/8e85e6/ffffff/loading%20error"; | ||
this.loading = false; | ||
return; | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.