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, $image, 0, 0, $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/>";
}


Reply With Quote
Bookmarks