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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:42:09+00:00 2026-06-01T12:42:09+00:00

Everything works fine, the only problem is that it loads very slow. It takes

  • 0

Everything works fine, the only problem is that it loads very slow. It takes 7 seconds to load a page containing 265 images. The images aren’t on a remote server, and they are thumbnails. They are being displayed at true height/width as well, so the server doesn’t have to resize them.

It shouldn’t be the getimagesize(), because in a previous iteration of the page every image also had a getimagesize() function and that loaded without the problem.

The only thing I can find that could be a problem would be the database. This is the setup:

TABLE albums:

| id | naam | urlnaam | actief |


TABLE fotos:

| id | url | ext | description | albumid |

So the albumid from fotos is linked to the id from albums.
Here’s the code:

$album = mysql_real_escape_string($_GET['fx2']);
mysql_select_db('user_fotos');
$i = 0;
$sql = mysql_query("SELECT a.naam, b.url, b.ext, b.description, b.id FROM albums AS a LEFT JOIN fotos AS b ON a.id = b.albumid WHERE a.urlnaam = '$album'");
while($row = mysql_fetch_assoc($sql)){
    if($i == 0){
        echo "Album: {$row['naam']}<br />";
        echo "<table><tr>";
    }
    if($i % 4 == 0){echo "</tr><tr>";}
    echo "<td align='center'>";
    $photourl = "http://www.mysite.com/fotos/$album/thumbs/" . $row['url'] . $row['ext'];
    $dimensions = getimagesize($photourl);
    $breedte = $dimensions[0];
    $lengte = $dimensions[1];
    if($breedte == '120'){$aspect="width='120px' height='{$lengte}px'";}else{$aspect="height='120px' width='{$breedte}px'";}
        echo "<div class='imageHolder' style='width:{$breedte}px; height:{$lengte}px;' onClick=\"parent.location='$album/{$row['id']}'\" /><img $aspect src='http://www.mysite.com/fotos/$album/thumbs/" . $row['url'] . $row['ext'] . "' alt='{$row['description']}' /></div>";
        echo "</td>";
        $i++;
}
echo "</tr></table>";
  • 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-01T12:42:10+00:00Added an answer on June 1, 2026 at 12:42 pm

    As others and myself have mentioned getting the imagesize() from a remote url will involve fetching the image slowing your script down:
    As I can see your using the actual dimensions so there is no need to actually fetch the size, also you may have some XSS problem with the album variable:
    Try this, your get the same result but much faster:

      <?php 
        $album = mysql_real_escape_string($_GET['fx2']);
        mysql_select_db('user_fotos');
    
        $sql = mysql_query("
        SELECT a.naam, b.url, b.ext, b.description, b.id 
        FROM albums AS a 
        LEFT JOIN fotos AS b ON a.id = b.albumid 
        WHERE a.urlnaam = '$album'");
    
        $i = 0;
        while($row = mysql_fetch_assoc($sql)){
            if($i == 0){
                echo "<p>Album: {$row['naam']}</p>";
                echo "<table><tr>";
            }
            if($i % 4 == 0){echo "</tr><tr>";}
            echo "<td align='center'>";
            echo "<div class='imageHolder' onClick=\"parent.location='".htmlentities($album)."/{$row['id']}'\" /><img src='./fotos/".htmlentities($album)."/thumbs/" . $row['url'] . $row['ext'] . "' alt='{$row['description']}' /></div>";
            echo "</td>";
            $i++;
        }
        echo "</tr></table>";
        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented this Jquery show/hide code and everything works fine except that the box
When I load http://maps.google.com/maps/api/js?sensor=false in a script tag, everything works fine for me in
Everything works fine locally when I do as follows: cat input | python mapper.py
I have my pickerview set up and everything works fine, but right now I
I am using hibernate annotations and when I do following everything works fine sessionFactory
I am trying to do versioning with NHibernate and everything works fine, however right
I just launched my first MVC3 application and everything works fine except cookies authorisation.
I'm getting a 404 on my server (IIS 7) but everything works fine on
I was trying to run androidx86-ieee.iso on VM and everything works fine. The VMs
I'm developing Swing application, and everything works fine usually. But I have an GUI

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.