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

  • SEARCH
  • Home
  • 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 9208839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:42:14+00:00 2026-06-18T00:42:14+00:00

I made a php program to repeat an image on a page in a

  • 0

I made a php program to repeat an image on a page in a square box.

The image repeats 100 times in a row and then again 100 times vertically.. that means total 100×100 images are repeating in that square box. The size of one such repeating image is 10×10 pixel.

Now the problem is when the site is to be tested on localhost, the page hangs, when it is tried to be opened, and after it is loaded on scrolling up and down it is slow and hangs a bit.

I used nested for loops to get the image repeated. The code for same is:

<?php
  for($i=1;$i<=100;$i++)
    {for($j=1;$j<=100;$j++)
        {
            echo '<div id="imagebox">';
            echo "<img src='images/image.png'>";
            echo '</div>';
        }
    }
  ?>

Guys what could be the problem??

Thanks in advance for any possible solution.

Any alternate programming technique?

  • 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-18T00:42:15+00:00Added an answer on June 18, 2026 at 12:42 am

    Why not try fetching the image dimensions and then setting the height and width of the container div equal to 100 times of height and width of the image (respectively) and then just use CSS background-repeat property to repeat the image on x and y axis. This solution might work as you are trying to repeat a single image.
    See it in action: http://jsfiddle.net/vzX9q

    The HTML:

    <div id="img"></div>
    

    The Javascript:

    $(document).ready(function() {
      var imgSrc = "http://lorempixel.com/100/100";
    
      $("#img").css({
        background: "url("+imgSrc+") repeat"
      });
    
     var newImg = new Image();
     newImg.src = imgSrc; 
    
    newImg.onload = function() {
      var imgHeight = newImg.height;
      var imgWidth = newImg.width;
    
      $("#img").css({
        width : imgWidth*100,
        height: imgHeight*100
      });
    }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP repeating of an image on a page I made a php
I have made a php page that sends an email message with multiple attachments.
My permalink structure is set so I have url.com/page I made a basic PHP
I'm still new to PHP/Javascript.I've made a simple Clock program in Javascript successfully. Now
I usually made php forms and try to use good practices in them. I'm
how made in PHP from format 52.593800, 21.448850 format +52° 35' 37.68, +21° 26'
I've made a php script, that has the job to print text on a
I have a contact form made with php on my website. The problem is
I'm using a Google Analytics API Class in PHP made by Doug Tan to
I made a little PHP script that checks if an email is valid. The

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.