A quick way (or alternative way) to dynamically load 40,000 links to an image map?

I am returning a GD image that is generated from user information in the database, now on the page where this image is viewed. I have the following area map for an image generated by the same type of request in order to create a link to this user profile. However, there are probably 40,000 users in the database ... in any case, that IS is working for me, but, as you can imagine, it takes a lot of time to download it.

<map id="pixel" name="pixel">

<?
    $map_x_1 = 0;
    $map_y_1 = 0;

    $map_x_2 = 5;
    $map_y_2 = 5;

    $block_num = 1;

    while ($map_y_2 <= 1000) {

        while ($map_x_2 <= 1000) {

            $actual_x_cood = $map_x_1+1;
            $actual_y_cood = $map_y_1+1;

            $grid_search = mysql_query("SELECT *
                            FROM project
                            WHERE project_x_cood = '$actual_x_cood' AND project_y_cood = '$actual_y_cood'") or die(mysql_error());

            $block_exists = mysql_num_rows($grid_search);

            if ($block_exists == 1) {

                echo("<area shape=\"rect\" coords=\"$map_x_1, $map_y_1, $map_x_2, $map_y_2\" href=\"/block/$block_num/\" alt=\"\" title=\"$block_num\" />\n");

            } else {

                echo("<area shape=\"rect\" coords=\"$map_x_1, $map_y_1, $map_x_2, $map_y_2\" href=\"/block/$block_num/\" alt=\"\" title=\"$block_num\" />\n");

            }

            $map_x_1 = $map_x_1 + 5;
            $map_x_2 = $map_x_2 + 5;

            $block_num = $block_num+1;  

        }

        $map_y_1 = $map_y_1 + 5;
        $map_y_2 = $map_y_2 + 5;

        $map_x_1 = 0;
        $map_x_2 = 5;

    }
?>

</map>

, jQuery div, , , . , .

, , , PHP? JS? !

0
2

( jquery) , .

- , 100 (1-100%). , .

: .

php , . . -.

-

+1

input:image. x-y JavaScript .

x-y- .

+2

Source: https://habr.com/ru/post/1789060/


All Articles