Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(histogram): 修复缩略图跨域请求问题

Timothy Yin321c9f211a35
diff --git a/app/components/Histogram.vue b/app/components/Histogram.vue
index 3fdf2417..09c47b05 100644
--- a/app/components/Histogram.vue
+++ b/app/components/Histogram.vue
@@ -23,12 +23,11 @@ watchEffect(() => {
histogramData.value = null
const img = new Image()
- img.crossOrigin = 'Anonymous'
- img.src =
- props.thumbnailUrl +
- (props.thumbnailUrl.includes('?') ? '&' : '?') +
- 't=' +
- Date.now()
+ img.crossOrigin = 'anonymous'
+
+ const url = new URL(props.thumbnailUrl)
+ url.searchParams.set('_cors', Date.now().toString())
+ img.src = url.toString()
img.onload = () => {
const canvas = document.createElement('canvas')