Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
Downloading and Storing Images in a Server Database

So currently my website is loading an JSON File from my server, looking for the data it needs and then showing it up on the screen as well as downloading and showing an image related to that info from a public API. I was wondering how would I go about storing the API downloaded image to my own servers database so before every image fetch it would check for the image in my server and if it doesn't exist, it would go to the public API and download and store it in my servers database?


This code below is a sample, when the site is loaded it pulls a random card from the JSON and displays its info along with the image. I want to download the image from the api, store it in my servers database and then check for said image before downloading as to reduce API calls to a minimum.

function RandomCard() {
const RC = Math.floor(Math.random() * cardAPIListings.data.length); 
var cardShowcase = document.getElementById("randomcardshowcase"); 
var randomCardImage = document.getElementById('randomImage'); 
  switch (cardAPIListings.data[RC].type) { 
    case "Spell Card": 
    case "Trap Card":

    cardShowcase.innerHTML = '\"' +cardAPIListings.data[RC].name + '\"' + '<br><br>' +  '[' +
    cardAPIListings.data[RC].race + ' / ' + cardAPIListings.data[RC].type + ']' + '<br>' + 
    'Attri: ' + cardAPIListings.data[RC].attribute + '<br><br>' + 'Effect: ' + '<br>' + 
    cardAPIListings.data[RC].desc;
      
    randomCardImage.src = cardAPIListings.data[RC].card_images[0].image_url;
    break;

Edit: The PUBLIC API that I'm using says this:

[ Card Images Users who pull our card images directly from our server instead of our google cloud repository will be immediately blacklisted.

Card images can be pulled from our Google Cloud server but please only pull an image once and then store it locally(I Assume this means Store it in your Own Server/API Database). If we find you are pulling a very high volume of images per second then your IP will be blacklisted and blocked.]


So I need a way to store the images in my own location as they are being downloaded from the Public API so I Dont get blacklisted.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Unless I'm misunderstanding your question, only store images and other binary data to the file system. No reason to burden database with big binary data. Only store file link (or URL) in the database.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda