J'ai une fonction que j'utilise depuis longtemps sur mon site afin de redimensionner mes images.
Depuis que mon hébergeur est passé de php4 vers php5 ma fonction ne fonctionne plus et ne trouve pas comment corriger le problème;
function resize_images($max_width, $max_height, $img_path)
{
$maxwidth = $max_width;
$maxheight = $max_height;
$imgpath = $img_path;
$imagehw = GetImageSize("$imgpath");
$imagewidth = $imagehw[0];
$imageheight = $imagehw[1];
if($imagewidth >= $imageheight)
{
if ($imagewidth > $maxwidth)
{
$imageprop = ($maxwidth*100)/$imagewidth;
$imagevsize = ($imageheight*$imageprop)/100 ;
$r_width = $maxwidth;
$r_height = ceil($imagevsize);
}
else
{
$r_width = $imagewidth;
$r_height = $imageheight;
}
$returned = array("$r_width", "$r_height", "$imagewidth", "$imageheight");
}
else
{
if ($imageheight > $maxheight)
{
$imageprop = ($maxheight*100)/$imageheight;
$imagevsize = ($imagewidth*$imageprop)/100 ;
$r_width = ceil($imagevsize);
$r_height = $maxheight;
}
else
{
$r_width = $imagewidth;
$r_height = $imageheight;
}
$returned = array("$r_width", "$r_height", "$imagewidth", "$imageheight");
}
return $returned;
}
J'appel la fonction comme ceci:$newwidth=resize_images("250", "250", "$url_racine/produits/img_prod/icones/".$row["image"]."") or die("rezine width erreur");
echo "<a href=\"produits_details.php?id=".$row["id"]."\"><img src=\"produits/img_prod/icones/".$row["image"]."\" border=\"0\" width='".$newwidth[0]."' height='".$newwidth[1]."' alt=\"".$row["name_".$_SESSION["lang"].""]."\"></a>\n";
Pouvez-vous m'aider svp?Merci!