-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 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
22 changes: 22 additions & 0 deletions
22
src/content/docs/es/reference/errors/expected-image-options.mdx
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,22 @@ | ||
--- | ||
title: Opciones de imagen esperadas. | ||
i18nReady: true | ||
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
--- | ||
|
||
> **ExpectedImageOptions**: Se esperaba que el parametro de getImage() fuera un objeto. Se recibió `OPTIONS`. (E03028) | ||
## ¿Qué salió mal? | ||
El primer parámetro de `getImage()` debería ser un objeto con las diferentes propiedades que se aplicarán a tu imagen. | ||
|
||
```ts | ||
import { getImage } from "astro:assets"; | ||
import myImage from "../assets/my_image.png"; | ||
|
||
const optimizedImage = await getImage({src: myImage, width: 300, height: 300}); | ||
``` | ||
|
||
En la mayoría de los casos, este error se produce porque los parámetros se han pasado directamente en lugar de dentro de un objeto. | ||
|
||
**Ver también:** | ||
- [Assets (Experimental)](/es/guides/assets/) |
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,26 @@ | ||
--- | ||
title: Se esperaba que src fuera una imagen. | ||
i18nReady: true | ||
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
--- | ||
|
||
> **ExpectedImage**: Se esperaba que la propiedad `src` fuera una imagen importada como ESM o una cadena de texto con la ruta de una imagen remota. Se recibieron `OPTIONS`. (E03027) | ||
## ¿Qué salió mal? | ||
La propiedad `src` de la imagen no es válida. El componente Image requiere que el atributo `src` sea una imagen que se haya importado con ESM o una cadena de texto. Esto también es válido para el primer parámetro de `getImage()`. | ||
|
||
```astro | ||
--- | ||
import { Image } from "astro:assets"; | ||
import myImage from "../assets/my_image.png"; | ||
--- | ||
<Image src={myImage} alt="..." /> | ||
<Image src="https://example.com/logo.png" width={300} height={300} alt="..." /> | ||
``` | ||
|
||
En la mayoría de los casos, este error ocurre cuando el valor pasado a `src` es undefined. | ||
|
||
**Ver también:** | ||
- [Assets (Experimental)](/es/guides/assets/) | ||
|
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