Hello all,
Im trying to redo my thumbnail script and not havning any luck. My old code executes but seems to not do anything. So I found some code online at php.net and tryed that. Thing is its doing the samthing. On a windows machine that is, but when i try it on a linux machine I get this error..
/home/test/www/phpthumb/images/test.jpg
Warning: imagejpeg(): Unable to open '/home/test/www/phpthumb/thumbnail' for writing in /home/test/www/phpthumb/func_thumbnail.php on line 83
now the folders and files have full permissions for a test to see if that was the case, but still no go
here is the thumbnail code I was trying
function image_createThumb($src,$dest,$maxWidth,$maxHeight,$quality=100) {
if (file_exists($src) && isset($dest)) {
// path info
$destInfo = pathInfo($dest);
// image src size
$srcSize = getImageSize($src);
// image dest size $destSize[0] = width, $destSize[1] = height
$srcRatio = $srcSize[0]/$srcSize[1]; // width/height ratio
$destRatio = $maxWidth/$maxHeight;
if ($destRatio > $srcRatio) {
$destSize[1] = $maxHeight;
$destSize[0] = $maxHeight*$srcRatio;
}
else {
$destSize[0] = $maxWidth;
$destSize[1] = $maxWidth/$srcRatio;
}
// path rectification
if ($destInfo['extension'] == "gif") {
$dest = substr_replace($dest, 'jpg', -3);
}
// true color image, with anti-aliasing
$destImage = imageCreateTrueColor($destSize[0],$destSize[1]);
imageAntiAlias($destImage,true);
// src image
switch ($srcSize[2]) {
case 1: //GIF
$srcImage = imageCreateFromGif($src);
break;
case 2: //JPEG
$srcImage = imageCreateFromJpeg($src);
break;
case 3: //PNG
$srcImage = imageCreateFromPng($src);
break;
default:
return false;
break;
}
// resampling
imageCopyResampled($destImage, $srcImage, 0, 0, 0, 0,$destSize[0],$destSize[1],$srcSize[0],$srcSize[1]);
// generating image
switch ($srcSize[2]) {
case 1:
case 2:
imageJpeg($destImage,$dest,$quality);
break;
case 3:
imagePng($destImage,$dest);
break;
}
return true;
}
else {
return false;
}
}
$thumb_location = "/home/test/www/phpthumb/images/thumbnail";
$getdir = "/home/test/www/phpthumb/images/test.jpg";
image_createThumb($getdir,$thumb_location,100,100);
gd is setup
PHP Version 4.3.4
GD 2.0.11
any ideas?