my problem has to do with an image upload script that i wrote.
I'll describe it, show the method that is throwing the error, and then also post the error message that I'm getting.
Also, this code works flawlessly on my development environment (ubuntu 7.04, php5(no safe mode), Apache 2.2)
I have no problem getting my script to upload images. it saves them fine in the '/images/managed/' folder.
It is only when this method executes that I get the error
Code: Select all
private function createThumb($fName,$kind){
$path = $_SERVER['DOCUMENT_ROOT'].$this->imgPath;
switch ($kind){
case 'jpg' : $fullImg = imagecreatefromjpeg($path.$fName);break;
case 'gif' : $fullImg = imagecreatefromgif($path.$fName);break;
case 'png' : $fullImg = imagecreatefrompng($path.$fName);break;
}
//generate thumbnail ratio & size
$size = getimagesize($path.$fName);
//ratio
($size[0]/$this->maxW) >= ($size[1]/$this->maxH) ?
$ratio = ($this->maxW/$size[0]) : ($ratio = $this->maxH/$size[1]);
//create new thumbnail sized image
$thumb = imagecreatetruecolor($size[0]*$ratio,$size[1]*$ratio);
//copy full sized image to thumbnail size
imagecopyresampled($thumb,$fullImg,0,0,0,0,$size[0]*$ratio,$size[1]*$ratio,$size[0],$size[1]);
//save the copy (currently this goes to a folder called thumbs inside of $path)
echo($path.$fName);
switch ($kind){
//*************** case 'jpg' : imagejpeg($thumb,$path.'thumbs.'.$fName);break; ****************(this is the one)
case 'gif' : imagegif($thumb,$path.$fName);break;
case 'png' : imagepng($thumb,$path.$fName);break;
}
}here is the error code:
Warning: imagejpeg() [function.imagejpeg]: Unable to access /sites/yuma4/deborahralston/home/public_html/images/managed/thumb_dfasf.jpg in /sites/yuma4/deborahralston/home/public_html/includes/imageMgr.php on line 346
Warning: imagejpeg() [function.imagejpeg]: Invalid filename '/sites/yuma4/deborahralston/home/public_html/images/managed/thumb_dfasf.jpg' in /sites/yuma4/deborahralston/home/public_html/includes/imageMgr.php on line 346