is het simpele width en height in html dat je in de <img src=""> moet plaatsen geen optie?
(idee van stefan voluit) zo dus:
<img src="link.html" width="200" height="100" border="0">
Succes..!
nou, als het plaatje dan kleiner is dan 200 width ... dan vergroot ie em :P das niet de bedoeling.
S
Stijn
17-02-2006 21:34
gewijzigd op 17-02-2006 21:46
deze functie heb ik gemaakt
<?
function image($file, $max=100){
$exists = getimagesize($file);
if($exists){
list($width, $height, $type, $size) = $exists;
if($width > $max OR $height > $max){
if($width > $height){
$factor = $max / $width;
$_height = round($height * $factor);
$_width = $max;
} else {
$factor = $max / $height;
$_height = $max;
$_width = round($width * $factor);
}
size = 'width="'.$_width.'" height="'.$_height.'"';
}
return '<img src="'.$file.'" align="right" '.$size.' hspace="5" border="0">';
}else{
return false;
}
}
?>
@ Stijn, jou plaatje doet t niet in FF alleen in IE ;) In FF zie je alleen allemaal tekst
Oké hipska, dat ga ik even proberen .. :D
B
Bernardo
17-02-2006 23:25
gewijzigd op 17-02-2006 23:31
Ik mis wat Hipska... volhgens mij wat vars... ik pruts wel wat. werkt ie ook?
Hier het hele script.
<?php
include ('../safe.php');
$id = $_GET['id'];
?>
<link rel="stylesheet" href="../style.css" type="text/css">
<h1>Foto album bekijken.</h1>
<p>
<hr>
<p>
<center>
<table border="0">
<tr><th colspan="2">Foto bekijken:</th></tr>
<tr>
<td>
<?php
$sql1 = "SELECT * FROM fotoalbum WHERE id='$_GET[img]' AND user='$id'";
$query1 = mysql_query($sql1);
$rij1 = mysql_fetch_object($query1);
$file = htmlspecialchars($rij1->img);
$omschrijvingbig = htmlspecialchars($rij1->omschrijving);
if(isset($_GET[img])){
function image($file, $max=100){
$exists = getimagesize($file);
if($exists){
list($width, $height, $type, $size) = $exists;
if($width > $max OR $height > $max){
if($width > $height){
$factor = $max / $width;
$_height = round($height * $factor);
$_width = $max;
} else {
$factor = $max / $height;
$_height = $max;
$_width = round($width * $factor);
}
$size = 'width="'.$_width.'" height="'.$_height.'"';
}
return '<img src="'.$file.'" align="right" '.$size.' hspace="5" border="0">';
}else{
return false;
}
}
}
?>
</td><td></td>
</tr>
</table>
<p>
<table border="1" width="90%" >
<tr><th>Fotoalbum:</th></tr>
<?php
$query = mysql_query("SELECT * FROM fotoalbum WHERE user = '$id'") or die(mysql_error());
while($row = mysql_fetch_array($query)){
?>
<tr>
<td align="left"><a href="bekijken.php?id=<?php echo $id; ?>&img=<?php echo $row[id]; ?>"><img src="<?php echo $row[img]; ?>" alt="<?php echo $row[omschrijving]; ?>" width="160" border="0"></a></td>
</tr>
<?php
}
?>
</table>
</center>
Ik heb een oplossing, als de getimagesize groter is dan 400 .. dan zet ie bij de width 400 neer .. anders niks :D
Ik weet niet of het werkt maar <img src="plaatje.jpg" width="1%" height="1%" border="0"> dan word ie altijd kleiner