react-native - React Native 调整图片 url
问题描述
我从 node.js 服务器获取图像 url 并将它们显示在我的应用程序中。目前,我的代码如下所示:
<Image source={{ uri: `https:${game.url}` }} style={[styles.photo, { width: game.width / 2, height: game.height / 1.4 }]} />
服务器返回的 URL 如下所示:
'//images.igdb.com/igdb/image/upload/t_thumb/co2dc0.jpg'
但是,尺寸和质量非常小。在我的代码中,我需要根据 api 文档将“t.thumb”参数替换为更大的参数
Break down:
https://images.igdb.com/igdb/image/upload/t_{size}/{hash}.jpg
size is one of the interchangeable size types listed below. hash is the id of the image. The image sizes are all maximum size but by appending _2x to any size, you can get retina (DPR 2.0) sizes (cover_small_2x).
Name Size Extra
cover_small 90 x 128 Fit
screenshot_med 569 x 320 Lfill, Center gravity
cover_big 264 x 374 Fit
logo_med 284 x 160 Fit
screenshot_big 889 x 500 Lfill, Center gravity
screenshot_huge 1280 x 720 Lfill, Center gravity
thumb 90 x 90 Thumb, Center gravity
micro 35 x 35 Thumb, Center gravity
720p 1280 x 720 Fit, Center gravity
1080p 1920 x 1080 Fit, Center gravity
如何用我提供的代码中的其他内容替换 t_thumb?
解决方案
推荐阅读
- react-native - 在 React Native 应用程序中使用 Branch.io 在 iOS 中延迟深度链接
- python - 为什么当列表中有两个元素并且索引为1时它说索引超出范围
- reactjs - 下一个 js 生产部署子页面上的 404 错误
- python - 如何让我的类函数返回一个字母而不是一个数字?
- scala - Akka gRPC + Slick 应用程序导致“IllegalStateException:无法初始化 ExecutionContext;AsyncExecutor 已关闭”
- python - 如何将结果值添加到 tsv 文件?
- html - 如何实现两个输入并排?
- android - 在 Flutter 应用中播放背景歌曲
- sql - 获取下一个 TimeStamped Result 以绑定到先前的结果
- amazon-web-services - AWS EventBridge - 使用第一个目标的输出作为下一个目标的输入