Here is my code for a gallery on the website that I am making
<h3>Gallery</h3>
<?php
include"includes/connection.php";
$sql = "select * from kategorije";
$res = mysqli_query($con, $sql);
while($row = mysqli_fetch_assoc($res))
{
?>
<h4 class="text-center"><?php echo ucwords($row['naziv']); ?></h4>
<?php
$id = $row['sifra'];
$sql1 = "select * from rad where kategorija = $id";
$res1 = mysqli_query($con, $sql1);
$n = mysqli_num_rows($res1);
if($n>0)
{
while($row1 = mysqli_fetch_assoc($res1))
{
$pid = $row1['sifra'];
?>
<div class="col-md-2 col_1">
<a href="single.php?id=<?php echo $pid ?>"><img src="uploads/<?php echo $row1['datoteka']; ?>" class="img-responsive" alt=""/></a>
</div>
<?php
}
}else{
?>
<div class="col-md-2 col_1">
<h6>No Images</h6>
</div>
<?php
}
?>
<div class="clearfix"></div>
<?php
}
?>
I need to make that all the photos in gallery have same height and width when they are uploaded, but I don't know how. I tried to insert this code, but it just doesn't work:
echo"<img src='$dir_path$files[$i]'style='width:150px;height:200px;'>
Also I tried in CSS but it won't work either.
Since you just want to display them in another size, you can achieve this by the way you tried, but with the correct syntax. I hope its this line of code where you want the resized image:
<a href="single.php?id=<?php echo $pid ?>"><img src="uploads/<?php echo `$row1['datoteka']; ?>" class="img-responsive" height="200" width="150" alt=""/></a>`
Let me know it it worked for you. It this wasen't the line you want to do it, keep in mind you simply have to follow the syntax:
<img src="http://url.com/pic.png" width="150" height="200">
Thats all. :)