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 9196243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:48:31+00:00 2026-06-17T21:48:31+00:00

Possible Duplicate: PHP repeating of an image on a page I made a php

  • 0

Possible Duplicate:
PHP repeating of an image on a page

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 solution like jquery or JS?

using a possible solution i made the id separate for each image by using this code

echo '<div id="imagebox"  . "i" . "j">';

But this also not helped

  • 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-17T21:48:32+00:00Added an answer on June 17, 2026 at 9:48 pm

    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.
    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: How to reset mysql pointer back to the first row in PHP?
Possible Duplicate: PHP image resize on the fly vs storing resized images I was
Possible Duplicate: PHP get both array value and array key I am using Codeigniters'
Possible Duplicate: PHP - reversed order in if statement Checking for null - what
Possible Duplicate: PHP create a file without fopen I want to create a file
Possible Duplicate: PHP Get end string on url between / and / I have
Possible Duplicate: php false place in condition I have noticed that a lot of
Possible Duplicate: php loop through associative arrays i have a variable which prints an
Possible Duplicate: PHP function to strip tags, except a list of whitelisted tags and
Possible Duplicate: php calculate float The accuracy of PHP float calculate Why does PHP

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.