0
    $count = 0;
                $Q = "SELECT (SELECT image_short_name FROM user WHERE username = '$user') as `image_short_name`"
                .",`image_id`,`image`"
                ." FROM `image`"
                ." ORDER BY RAND()"
                ." LIMIT 30";
                $R = mysql_query($Q);



echo "
        <div id ='bg'>
            <div id='context'>

                <table>                       
                    <tr>     
                    ";           
                        while($row = mysql_fetch_assoc($R))
                            {
                                echo "<td>";
                                $image_db = $row['image'];
                                $src = "data:image/gif;base64," . $image_db;
                                echo" <img src=\"$src\"  height='20%' width='20%' class='image' />";
                                echo "</td>";
                                $count++;
                                if($count == 5)       //5 rows
                                {
                                    echo "</tr><tr>"; // Start a new row at 6 cells
                                    $count = 0;
                                }
                            }
                echo " 
                    </tr>
                </table>

            </div>
        </div>   
        ";

1st problem
i am having problem with my table. its printing all image with different size.

2nd problem
i want to print images name too. and iam not sure how to do that.

2
Contributors
1
Reply
10
Views
5 Years
Discussion Span
Last Post by whiteyoh
0

The image is set in your code to be 20% height and width. As a result, if you have something that is 100 x 100, it will display 20 x 20. If its 1000 x 1000 it will display 200 x 200.

What i suggest you do is make sure that either the images are corrected on upload, so are all the same size, or you make sure they are uploaded the same size.

To display the image name you will either have to have stored its name or use an algorythm to generate a name.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.