- function IMGredimvalid($imaget,$tailleX,$tailleY,$sinon,$ombreX,$ombreY) {
- if ($imaget!="") {
- if (!@fopen($imaget, "r")) {
- $validite=0;
- } else {
- $validite=1;
- }
- $up=strtoupper($imaget);
- $extension=substr($up,strlen($up)-3);
- if (($extension!="JPG") AND ($extension!="GIF") AND ($extension!="BMP")) { $validite=0; }
- if ($validite==1) {
- $taille=getimagesize($imaget);
- $largeur=$taille[0];
- $hauteur=$taille[1];
- if ($largeur>$tailleX) {
- $coef=$largeur/$tailleX;
- $hauteur=$hauteur/$coef;
- $largeur=$tailleX;
- }
- if ($hauteur>$tailleY) {
- $coef=$hauteur/$tailleY;
- $largeur=$largeur/$coef;
- $hauteur=$tailleY;
- }
- }
- } else {
- $validite=0;
- }
- $ret="";
- if ($ombreX=="") { $ombreX=0; }
- if ($ombreX<0) { $ombreX=0; }
- if ($ombreY=="") { $ombreY=0; }
- if ($ombreY<0) { $ombreY=0; }
- if ($validite==1) {
- $ret="<img alt='Photo' border='0' src='$imaget' width='$largeur' height='$hauteur' style='filter:progid:DXImageTransform.Microsoft.dropShadow(Color=silver,offX=$ombreX,offY=$ombreY,positive=true);'>";
- } else {
- if ($sinon!="") {
- $ret="<img alt='Photo' border='0' src='$sinon' width='$tailleX' height='$tailleY' style='filter:progid:DXImageTransform.Microsoft.dropShadow(Color=silver,offX=$ombreX,offY=$ombreY,positive=true);'>";
- } else {
- $ret="";
- }
- }
- return $ret;
- }
function IMGredimvalid($imaget,$tailleX,$tailleY,$sinon,$ombreX,$ombreY) {
if ($imaget!="") {
if (!@fopen($imaget, "r")) {
$validite=0;
} else {
$validite=1;
}
$up=strtoupper($imaget);
$extension=substr($up,strlen($up)-3);
if (($extension!="JPG") AND ($extension!="GIF") AND ($extension!="BMP")) { $validite=0; }
if ($validite==1) {
$taille=getimagesize($imaget);
$largeur=$taille[0];
$hauteur=$taille[1];
if ($largeur>$tailleX) {
$coef=$largeur/$tailleX;
$hauteur=$hauteur/$coef;
$largeur=$tailleX;
}
if ($hauteur>$tailleY) {
$coef=$hauteur/$tailleY;
$largeur=$largeur/$coef;
$hauteur=$tailleY;
}
}
} else {
$validite=0;
}
$ret="";
if ($ombreX=="") { $ombreX=0; }
if ($ombreX<0) { $ombreX=0; }
if ($ombreY=="") { $ombreY=0; }
if ($ombreY<0) { $ombreY=0; }
if ($validite==1) {
$ret="<img alt='Photo' border='0' src='$imaget' width='$largeur' height='$hauteur' style='filter:progid:DXImageTransform.Microsoft.dropShadow(Color=silver,offX=$ombreX,offY=$ombreY,positive=true);'>";
} else {
if ($sinon!="") {
$ret="<img alt='Photo' border='0' src='$sinon' width='$tailleX' height='$tailleY' style='filter:progid:DXImageTransform.Microsoft.dropShadow(Color=silver,offX=$ombreX,offY=$ombreY,positive=true);'>";
} else {
$ret="";
}
}
return $ret;
}