try
{
switch($this->img["format"])
{
case "JPEG":
//JPEG
$this->img["src"] = @imagecreatefromjpeg ($imgfile);
break;
case "PNG":
//PNG
$this->img["src"] = @imagecreatefrompng ($imgfile);
break;
case "GIF":
//GIF
$this->img["src"] = @imagecreatefromgif ($imgfile);
break;
} // End Switch
}
catch
{
// Failsafe!
if (@imagecreatefromjpeg($imgfile))
{
//JPEG
$this->img["format"]="JPEG";
$this->img["src"] = @imagecreatefromjpeg($imgfile);
}
elseif (@imagecreatefrompng($imgfile))
{
//JPEG
$this->img["format"]="PNG";
$this->img["src"] = @imagecreatefrompng($imgfile);
}
elseif (@imagecreatefromgif($imgfile))
{
//JPEG
$this->img["format"]="GIF";
$this->img["src"] = @imagecreatefromgif($imgfile);
}
elseif (@imagecreatefromwbmp($imgfile))
{
//JPEG
$this->img["format"]="JPEG";
$this->img["src"] = @imagecreatefromwbmp($imgfile);
}
}
OK, so you quite obviously can't use try... catch... like this!
What would I use to atempt to execute a block of code and on failure of ANY of them, execute the catch STYLE block?
Help?!**!??