How to take images only vertically?

1

My question is this: Do I have to take only the images that are vertical and change them? I have several images on the site, many of them are horizontal and some vertical. I want to get only the verticals and change their size.

This is my code:

<?php               
        require_once("classe/conexao.class.php");
        $c = new Conexao();
        $c->Conecta();
        $c->SelecionaBase();

        $titulo = $_GET['ti'];
        $sql = mysql_query("SELECT * FROM ultimos_eventos WHERE nome_fotos = '$titulo'");
        while($aux = mysql_fetch_assoc($sql)){

                $nome = $aux['nome_fotos'];
                $imagem = $aux['img'];
                $id = $aux['id'];
                $_SESSION['id'] = $id;

                print"  
                    <div class=\"row1\">
                    <div class=\"portfolio-item col-md-3 col-sm-6\">
                        <div class=\"portfolio-thumb\">
                            <img src=\"images/$imagem\" alt=\"$nome\">
                            <div class=\"portfolio-overlay\">
                                <h3>$titulo</h3>
                                <a href=\"images/$imagem\" data-rel=\"lightbox\" class=\"expand\">
                                    <i class=\"fa fa-search\"></i>
                                </a>
                            </div> <!-- /.portfolio-overlay -->
                        </div> <!-- /.portfolio-thumb -->
                    </div> <!-- /.portfolio-item -->
                </div>";
        }
        mysql_close();
 ?>

How do I implement this in my code?

    
asked by anonymous 16.07.2015 / 16:39

1 answer

1

You can compare the dimensions of the image, so if the width is smaller than the height, you can consider that the image is vertical, right? Example:

var imgs = document.getElementsByTagName("img");

for (var i = 0; i < imgs.length; i++)
{
    if (imgs[i].width < imgs[i].height)
    {
        alert(imgs[i].title);
    }
}

Fiddle

    
16.07.2015 / 16:55