Skip to content

Commit

Permalink
feat(app): use contentful image resizing (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
cor authored Jul 25, 2024
2 parents 611e424 + e26990e commit e13a186
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion site/src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const fontWeights = [100, 200, 300, 400, 500, 600, 700, 800, 900]
* og spec: 1200x630, .png
* docs: https://github.com/o-az/imageine
*/
const openGraphImage = `https://ipx.up.railway.app/f_png,s_1200x630/${image}`
const openGraphImage = `${image}?fit=fill&f=center&fm=png&w=1200&h=630`
---

<!doctype html>
Expand Down
8 changes: 3 additions & 5 deletions site/src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ const { width, height } = coverFields.file.details.image as {
{blogPost.fields.author}
</p>
</div>
<Image
{width}
{height}
<img
class="my-3"
src={`https://ipx.up.railway.app/f_png,s_1344x706/${imageUrl}`}
src={`${imageUrl}?fit=fill&f=center&fm=avif&w=1344&h=706`}
loading="eager"
alt={coverFields.title}
data-contentful-field-id="cover"
Expand Down Expand Up @@ -389,7 +387,7 @@ const { width, height } = coverFields.file.details.image as {
const dataFields = asset.data.target.fields
const imageUrl = imageWithProtocol(dataFields.file.url)
const { width, height } = dataFields.file.details.image
return `<Image src="${imageUrl}" alt="${dataFields.title}" width={${width}} height={${height}} />`
return `<img src="${imageUrl}?fm=avif&w=1366" alt="${dataFields.title}"></img>`
},
[INLINES["HYPERLINK"]]: (params) => /* html */ `
<a target="_blank" href="${params.data.uri}" rel="noopener noreferrer">${(params.content.at(0) as any)?.value}</a>`,
Expand Down

0 comments on commit e13a186

Please sign in to comment.