E
E
EvdokarovValerii2014-05-16 05:01:21
PHP
EvdokarovValerii, 2014-05-16 05:01:21

How to arrange pictures in a grid?

Hello, I have this code. Pictures are displayed in one column, it is necessary that there is a grid in 3 rows.

<?PHP
class main extends Core {
public function get_content (){
$query="SELECT a.id_photo, a.img_src, a.photo_name, b.id_user, b.name_user, b.id_user from t_photo as a, t_user as b where a.photo_name=b.id_user";
        $result = mysql_query ($query);
        if(!$result)  {
        exit (mysql_error () );
        }      
                                echo '<div class="content">';
        $row = array ();
        for ($i=0; $i < mysql_num_rows ($result); $i++) {      
        $row = mysql_fetch_array ($result, MYSQL_ASSOC);
        echo '<div class="content_usr">';
        printf ("<div style=';overflow: hidden; width:250px;'>
        <div style='float:none;
        border: 2px solid $55c5e9;
        padding: 15px;
        background:#666;
        margin-right:0px;
        margin-bottom:-10px;'><img src='%s' style='height:150px;'/><br> на фото: <b><a href='?option=view&id_user=%s'>%s</a></b></div></div>", $row ['img_src'],$row ['id_user'], $row ['name_user']);  echo '</div>';
        }echo '</div>';
        }
        }
?>

Also, in order not to produce new topics, I would like to ask a couple of questions:
1. Where can I read about image tagging?
2. How can I make it open a new window with it in full size when clicking on an image?
3. Something very strange is going on with the encoding on this site, on most it is UTF-8, but on some it is UTF-8 (without BOM) (in this case, the entire Russian text of the edge is on the page, but if you put the UTF-8 code, why it doesn't work, It's written in the header
<meta http-equiv=content-type content="text/html; charset=utf-8" />

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mindnomind, 2014-05-16
@EvdokarovValerii

Write in divs with images style="float:left;"and add after every 3rd image.
You can also use the value of the inline-block property display - read
1. It seems to me that you shouldn’t tag images too much - the best solution is to insert a real description of the image in the alt and title attributes
2. Use some js solution - for example
3. Write in .htaccess AddDefaultCharset UTF-8and do it on utf-8 files without BOM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question