1
My question is the following: Is there any way I can take Javascript 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 take only the vertical ones 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?
type i do this script I want to give the size only img in vertical change only it as q i do it?
– carlos goncalves
@carlosgoncalves you just explained that you want to select the images but did not say what you want to do with them. So how to help in this. Inside the loop you already have the image, just manipulate it.
– DontVoteMeDown
i want to pick up only the verticals I’m doing inside the loop you send and it always picks tds msm I specify that I want only the verticals
– carlos goncalves
@carlosgoncalves use
console.log(imgs[i].width)
inside the if inside the loop to see if JS is reading the attribute correctly. Know how to debug with dev tools ?– DontVoteMeDown
face in javascript manjo nd manjo nd msm to scratch Aki intao a Resp for your Perg and not
– carlos goncalves
@carlosgoncalves the command
console.log
printa value in your console, which is in the Dev Tool which in the most common browsers opens with the F12 key. In Dev Tools you will have several tabs, look for Console and its value will be there imprinted.– DontVoteMeDown