www.webdeveloper.com
Results 1 to 6 of 6

Thread: PHP images heavy load.

Threaded View

  1. #1
    Join Date
    Dec 2011
    Posts
    20

    PHP images heavy load.

    So I have a heavy load of total ~64 split images in <TD> background from the one source.jpg(which size 70KB). I don't know how to fix that, it seems that something wrong in my code ,please help me to solve that. Code of split images works fine, but loads those images for about ~15seconds.

    PHP Code:
    // img.php file for displaying images
    <?php
    $in_filename 
    'source.jpg';

    $xcord $_REQUEST['ggridx']-1;
    $ycord $_REQUEST['ggridy']-1;

    //list($width, $height) = getimagesize($in_filename);

    $map_grid_size 60;

    $image imagecreatefromjpeg($in_filename);
    $new_image imagecreatetruecolor($map_grid_size$map_grid_size);

    imagecopy($new_image$image00$xcord*$map_grid_size$ycord*$map_grid_size$map_grid_size$map_grid_size);

    header('Content-Type: image/jpeg');
    imagejpeg($new_image);
    imagedestroy($new_image);
    imagedestroy($image);

    ?>
    PHP Code:
    // Main file where I'm calling
        
    $map_display "";
        for (
    $Ty $start_y$Ty <= $end_y$Ty++) {
            
    $map_display .= "<tr>";
            for (
    $Tx $start_x$Tx <= $end_x$Tx++) {
                
    //show grid
                
    $map_display .= "<td style=\"background-image: url('img.php?ggridx=$Tx&ggridy=$Ty');\">";
                
    $map_display .= DisplayGrid($Tx,$Ty);
                
    $map_display .= "</td>";
            }
            
    $map_display .= "<tr/>";
        } 
    Last edited by xbatista; 04-25-2012 at 03:22 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles