Function not returning a value in php 5
Posted: Wed Dec 13, 2006 1:47 pm
First page:
the function
now I know thumbnail contains somethign because i put in an echo in the function and exit so I could see it. however, the function is not returning it. any theories on why?
Code: Select all
$test=createThumbnail($_FILES['fleImage']['tmp_name'],$imgPath,THUMBNAIL_WIDTH,75,TRUE);
print_r($test);
exit();Code: Select all
function createThumbnail($srcFile, $destFile, $width, $quality = 75,$test=FALSE)
{
$thumbnail = '';
if (file_exists($srcFile) && isset($destFile))
{
$size = getimagesize($srcFile);
$w = number_format($width, 0, ',', '');
$h = number_format(($size[1] / $size[0]) * $width, 0, ',', '');
$thumbnail = copyImage($srcFile, $destFile, $w, $h, $quality);
$name=explode("/",$thumbnail);
$size=count($name);
}
$answer=basename($thumbnail);
if (basename($thumbnail)=="")
{
$answer= $name[$size-1];
}
// return the thumbnail file name on sucess or blank on fail
return $answer;
}