Giphy / GiphyAPI

Public facing API docs, notes and more
1.9k stars 282 forks source link

How to reduce the quality of the gifs. #252

Closed Rananjaya closed 1 year ago

Rananjaya commented 1 year ago

Hi, I'm using GiphyAPI for my react native app. because i use expo for app. normally gif Loding is getting so much time in current implementation. is there any way to reduce the size or quality of the gif. Thanks

const getGifs = () => { let url = 'http://api.giphy.com/v1/gifs/trending?api_key=#'; if (searchTerm && searchTerm !== '') { url = http://api.giphy.com/v1/gifs/search?q=${searchTerm}&api_key=#; } else { url = 'http://api.giphy.com/v1/gifs/trending?api_key=#'; } console.warn(url); axios.get(url) .then((gif) => { const gifsObject = gif.data.data;

    delete gifsObject.meta;
    delete gifsObject.pagination;
    const gifArray = Object.values(gifsObject);
    setgifs(gifArray);
  })
  .then(
    () => renderGifs(),
  )
  .catch(error => console.log(error));

};

Rananjaya commented 1 year ago

found the solution.