Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add width and height properties to images (#1035)

Zack Krida7ae0ed8dbd22
diff --git a/src/components/VAllResultsGrid/VImageCellSquare.vue b/src/components/VAllResultsGrid/VImageCellSquare.vue
index 201b7c59f..5478413ab 100644
--- a/src/components/VAllResultsGrid/VImageCellSquare.vue
+++ b/src/components/VAllResultsGrid/VImageCellSquare.vue
@@ -13,12 +13,12 @@
>
<img
ref="img"
- class="w-full h-full object-cover rounded-sm"
+ class="w-full h-full object-cover rounded-sm bg-dark-charcoal-10 text-dark-charcoal-10"
loading="lazy"
:alt="image.title"
:src="getImageUrl(image)"
- :width="image.width"
- :height="image.height"
+ :width="250"
+ :height="250"
itemprop="thumbnailUrl"
@error="onImageLoadError($event, image)"
/>
diff --git a/src/components/VImageGrid/VImageCell.vue b/src/components/VImageGrid/VImageCell.vue
index 5357623be..6b6cd9692 100644
--- a/src/components/VImageGrid/VImageCell.vue
+++ b/src/components/VImageGrid/VImageCell.vue
@@ -1,7 +1,7 @@
<template>
<VLink
:href="'/image/' + image.id"
- class="w-full block group relative overflow-hidden rounded-sm focus:ring-[3px] focus:ring-pink focus:ring-offset-[3px] focus:outline-none"
+ class="w-full block group relative overflow-hidden rounded-sm focus:ring-[3px] focus:ring-pink focus:ring-offset-[3px] focus:outline-none bg-dark-charcoal-10 text-dark-charcoal-10"
:aria-label="image.title"
:style="`width: ${containerAspect * widthBasis}px;flex-grow: ${
containerAspect * widthBasis
@@ -18,6 +18,8 @@
class="margin-auto block w-full"
:alt="image.title"
:src="getImageUrl(image)"
+ :width="imgWidth"
+ :height="imgHeight"
@load="getImgDimension"
@error="onImageLoadError($event, image)"
/>