Comments (3)
Hi @caleb15 as you can see here the module shows the fixed_width_downsampled
image from the images
object. In my opinion, this is the best format that combines loading speed, rendering performances, and image quality (and I also seem to remember reading something about this topic). And yes, it's not the best one in quality but is a compromise.
It's not a bad idea to add a prop that customizes this setting, but if a user uses this without knowing what heβs doing, he could drastically compromise the performances.
Anyway, feel free to open a PR to improve this. π
For your records, this is the complete images
object:
"images": {
"original": {
"height": "283",
"width": "310",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.gif",
"mp4_size": "16710",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.mp4",
"webp_size": "8446",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.webp",
"frames": "3",
"hash": "720702b1077d015b77d327da67f353ae"
},
"downsized": {
"height": "283",
"width": "310",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.gif"
},
"downsized_large": {
"height": "283",
"width": "310",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.gif"
},
"downsized_medium": {
"height": "283",
"width": "310",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.gif"
},
"downsized_small": {
"height": "282",
"width": "310",
"mp4_size": "11286",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy-downsized-small.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy-downsized-small.mp4"
},
"downsized_still": {
"height": "283",
"width": "310",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy_s.gif"
},
"fixed_height": {
"height": "200",
"width": "219",
"size": "3923",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200.gif",
"mp4_size": "7137",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200.mp4",
"webp_size": "18468",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200.webp"
},
"fixed_height_downsampled": {
"height": "200",
"width": "219",
"size": "3923",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200_d.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200_d.gif",
"webp_size": "5454",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200_d.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200_d.webp"
},
"fixed_height_small": {
"height": "100",
"width": "110",
"size": "1785",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100.gif",
"mp4_size": "3517",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100.mp4",
"webp_size": "7880",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100.webp"
},
"fixed_height_small_still": {
"height": "100",
"width": "110",
"size": "685",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100_s.gif"
},
"fixed_height_still": {
"height": "200",
"width": "219",
"size": "1531",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200_s.gif"
},
"fixed_width": {
"height": "183",
"width": "200",
"size": "3551",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w.gif",
"mp4_size": "6582",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w.mp4",
"webp_size": "16578",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w.webp"
},
"fixed_width_downsampled": {
"height": "183",
"width": "200",
"size": "3551",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w_d.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w_d.gif",
"webp_size": "5012",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w_d.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w_d.webp"
},
"fixed_width_small": {
"height": "92",
"width": "100",
"size": "1639",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100w.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100w.gif",
"mp4_size": "3341",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100w.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100w.mp4",
"webp_size": "6976",
"webp": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100w.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100w.webp"
},
"fixed_width_small_still": {
"height": "92",
"width": "100",
"size": "622",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/100w_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=100w_s.gif"
},
"fixed_width_still": {
"height": "183",
"width": "200",
"size": "1381",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/200w_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=200w_s.gif"
},
"looping": {
"mp4_size": "397885",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy-loop.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy-loop.mp4"
},
"original_still": {
"height": "283",
"width": "310",
"size": "2706",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy_s.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy_s.gif"
},
"original_mp4": {
"height": "438",
"width": "480",
"mp4_size": "16710",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy.mp4"
},
"preview": {
"height": "282",
"width": "310",
"mp4_size": "11286",
"mp4": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy-preview.mp4?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy-preview.mp4"
},
"preview_gif": {
"height": "283",
"width": "310",
"size": "7303",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy-preview.gif?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy-preview.gif"
},
"preview_webp": {
"height": "283",
"width": "310",
"size": "8446",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/giphy-preview.webp?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=giphy-preview.webp"
},
"480w_still": {
"height": "438",
"width": "480",
"size": "5959",
"url": "https://media1.giphy.com/media/QTykRTKdn38D07zMCa/480w_s.jpg?cid=e8452e68af7mokxvrbcotxmmkb3bupvjio6lqw60sk7w8ble&rid=480w_s.jpg"
}
},
from react-giphy-searchbox.
Thanks for the good explanation! I would suggest adding in a prop to customize the setting. That way high-quality/slower-loading gifs could be used for desktop users and lower quality/faster-loading for mobile users. Best of both worlds :)
from react-giphy-searchbox.
Actually even better method with network API: https://stackoverflow.com/a/47511842
Sadly not yet supported in Firefox: https://caniuse.com/netinfo
psuedocode:
if network API exists:
use_high_quality = network_speed > 10 MBPS or whatever just throwing out a arbitrary number
else:
use_high_quality = !is_mobile
# pass in use_high_quality to react-giphy-searchbox
from react-giphy-searchbox.
Related Issues (20)
- README.md: project logo broken on npmjs.com
- Remove Axios.
- Production API Key HOT 2
- Feature Request - Search Text HOT 9
- Autofocus the searchbox prop HOT 3
- Attribution & Giphy Guidelines HOT 7
- Specify a hundred percent width to the component HOT 1
- Module parse failed: Unexpected character 'οΏ½' during yarn build HOT 2
- [Bug] Cannot read property 'total_count' of undefined HOT 17
- CSS Modules cannot be imported from within node_modules HOT 3
- Add typescript types
- Duplicate component keys HOT 1
- Usage in existing form component HOT 1
- How to make the component fully responsive with screen size
- Uncaught ReferenceError: module is not defined
- Don't nest search input in form HOT 2
- Update npm package with last fix
- Outdated react peer dependencies cause issues
- Package not installing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-giphy-searchbox.