Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:05:26+00:00 2026-06-02T16:05:26+00:00

I have a database with images that i need to load on-the-fly per user’s

  • 0

I have a database with images that i need to load on-the-fly per user’s request. The images would go as background images of separate s in an encompassing div container… something like image scroller.

The database is currently a local database but this is not my issue.

the issue is that the database may not have all the images that i have requested…and i may get one or more images that are non-existent… and since things are asynchronous on the database front and the loading image front as well, i am not sure how to go about replacing a non-existent image with a standard placeholder image. I cannot do it on the fly in a loop since that executes way before loading even happens.
I tried using .Load and .error, but i am not sure how i can do that on a background image.

Is there a standard and simple way to deal with this.. preferably without plugins since i have many as is…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:05:27+00:00Added an answer on June 2, 2026 at 4:05 pm

    It seems i could not get away from having to create another DOM elem. Here is what i am now using:

    <div style="background:url(providerSrc)">
    <img
         style="display:none" 
           src="providerSrc"
       onerror="this.parentNode.style.backgroundImage='url(fallbackSrc)'"  
       />
    </div>
    

    This is taken from: http://www.daveoncode.com/2010/08/20/image-background-fallback-img-tag-error-handlers/

    If you know of ‘better’ solution please reply

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table with images that I need to display. In my
I have these images that I am getting off my server and a database
Basically I have a database with two tables, that is, Updates table and Images
I have an application that stores images in a database. Now I have learned
I have a list of images that are pulled from a database and loaded
I have a JavaScript slideshow that pre-loads images out of a MySQL database and
I have a very large database of jpeg images, about 2 million. I would
I need to be able to save and load images into an SQLite database
I have a string in my database that represents an image. It looks like
I have links of images in my database e.g.-http://accessories.us.dell.com/sna/images/products/large/330-5288.jpg above link of an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.