Nieuw lid |
|
hey,
ik ben bezig met men fotoalbum te herschrijven alles werkt behalve 1 pagina niet hij moet met gd library kijken welke groote de foto heeft ( height en width ) en die geeft hij niet weer weet iemand hoe ik het kan oplossen ?
het kan zijn dat er wat onzinnige code inzit maar ik ben ook nog maar een beginner
dit is de code
<?php
error_reporting(E_ALL);
include "nieuws/connect.php";
$ikke = $_GET['id'] ;
$query = "SELECT * FROM images WHERE id = 'ikke' " ;
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
$foto = $row->image_path ;
$MAX_WIDTH = "500";
$MAX_HEIGHT = "500";
$img = null;
$img = @imagecreatefromjpeg($row->image_path);
# If an image was successfully loaded, test the image for size
if ($img) {
# Get image size and scale ratio
$width = imagesx($img); //this will get the width of the image(x-axis)
$height = imagesy($img); //this will get the height of the image(y-axis)
echo "$width" ;
echo "$height" ;
if ($width == 1280 | $height == 960) {
?>
<img src="img/<?php echo "$foto" ; ?>.jpg" width="500" height="375">
<?php
}
if ($width == 800 | $height == 600) {
?>
<img src="img/<?php echo "$foto" ; ?>.jpg" width="500" height="375">
<?php
}
if ($width == 960 | $height == 1280) {
?>
<img src="img/<?php echo "$foto" ; ?>.jpg" width="375" height="500">
<?php
}
if ($width == 640 | $height == 480) {
?>
<img src="img/<?php echo "$foto" ; ?>.jpg" width="500" height="375">
<?php
}
if ($width == 1024 | $height == 768) {
?>
<img src="img/<?php echo "$foto" ; ?>.jpg" width="500" height="375">
<?php }
}
}
?>
<?php include "nieuws/connect.php"; $ikke = $_GET['id'] ; $query = "SELECT * FROM images WHERE id = 'ikke' " ; $foto = $row->image_path ; $MAX_WIDTH = "500"; $MAX_HEIGHT = "500"; $img = null; $img = @imagecreatefromjpeg($row->image_path); # If an image was successfully loaded, test the image for size if ($img) { # Get image size and scale ratio $width = imagesx($img); //this will get the width of the image(x-axis) $height = imagesy($img); //this will get the height of the image(y-axis) if ($width == 1280 | $height == 960) { ?> <img src="img/ <?php echo "$foto" ; ?>.jpg" width="500" height="375"> <?php } if ($width == 800 | $height == 600) { ?> <img src="img/ <?php echo "$foto" ; ?>.jpg" width="500" height="375"> <?php } if ($width == 960 | $height == 1280) { ?> <img src="img/ <?php echo "$foto" ; ?>.jpg" width="375" height="500"> <?php } if ($width == 640 | $height == 480) { ?> <img src="img/ <?php echo "$foto" ; ?>.jpg" width="500" height="375"> <?php } if ($width == 1024 | $height == 768) { ?> <img src="img/ <?php echo "$foto" ; ?>.jpg" width="500" height="375"> <?php } } } ?>
|