To say the least this debugging has been frustrating, and I don't think the wiskey is going to help.
I've been programming now for 2.5 years so I know more than the average newbie, but I have not been able to figure this one out. Maybe some veterans out there could let me a hand.
Here is the scenario, - I have a pic uploading script located on 2 websites with identical code, on 1 website it works fine, on the other I am getting this error message.
This is the error :
Warning: getimagesize(0) [function.getimagesize]: failed to open stream: No such file or directory in /home/5292/domains/[mywebsite]/html/includes/images.php.lib on line 37
Warning: getimagesize(0) [function.getimagesize]: failed to open stream: No such file or directory in /home/5292/domains/[mywebsite]/html/includes/images.php.lib on line 37
Failed to create thumbnail image: Unable to retrieve image info from file
Here is the code line 37 found in "images.php.lib" (which is an included file within my pic uploading file)
<?php
function CreateScaledImage($file, $maxSize, &$errMsg)
{
$tmpFile = $scaledImage = null;
$errMsg = "";
// Extract image size:
$imageSize = getimagesize($file); :mad: LINE 37
if ($imageSize)
{
// Pull original size:
$gdWidth = $imageSize[0];
$gdHeight = $imageSize[1];
$gdType = $imageSize[2];
// Check to make sure we support this image type:
if (imagetypes() & $gdType)
{
$oldImage = null;
switch($gdType)
{
case IMAGETYPE_GIF:
$oldImage = imagecreatefromgif($file); break;
case IMAGETYPE_JPEG:
$oldImage = imagecreatefromjpeg($file); break;
case IMAGETYPE_PNG:
$oldImage = imagecreatefrompng($file); break;
case IMAGETYPE_WBMP:
$oldImage = imagecreatefromwbmp($file); break;
default:
$errMsg = "Image type not supported";
}
if ($oldImage)
{
// Figure out scale factor:
$scale = ($gdWidth > $gdHeight) ? $gdWidth / $maxSize : $gdHeight / $maxSize;
// Calc new scaled size:
$gdNewWidth = round($gdWidth / $scale);
$gdNewHeight = round($gdHeight / $scale);
$newImage = imagecreatetruecolor($gdNewWidth, $gdNewHeight);
$bReturn = imagecopyresampled(
$newImage, $oldImage,
0, 0, 0, 0,
$gdNewWidth, $gdNewHeight, $gdWidth, $gdHeight
);
if (!$bReturn)
$errMsg = "Failed to resize image";
else
$scaledImage = $newImage;
// Cleanup:
imagedestroy($oldImage);
}
else
$errMsg = "Unable to open image file $file";
}
else
$errMsg = "Image type not supported";
}
else
$errMsg = "Unable to retrieve image info from file"; :eek: ERROR Message that I am getting
if ($scaledImage)
{
$tmpFile = GetTempFilename();
imagejpeg($scaledImage, $tmpFile);
}
return $tmpFile;
}
?>
Can anyone out there offer a glimmer of hope as to why this is working on another website that I host and returning and error on this one?
Maybe there is another solution out there?
I can paste the code for my uploading script as well if needed.
Thanks, - B