Okay, so I am trying to write a function for making thumbnails, here's the function (you can ignore all the string functions, that all works properly):
The $originalImage is the url to an image that was uploaded and moved to it's appropriate directory. The first two image functions I used work how they're suppose to (I checked the folder and found the black rectangle jpeg).PHP Code:function makeThumbnail($originalImage, $username)
{
$sidemax = 250;
$removestr = $_SERVER['DOCUMENT_ROOT'] . 'users/' . $username . '/images/';
$removelen = strlen($removestr);
$originalImageName = substr_replace($originalImage, '', 0, $removelen);
$thumbnailName = 'thm-' . $originalImageName;
$thumbnailName = $removestr . $thumbnailName;
$dimensions = getimagesize($originalImage);
$ow = $dimensions[0];
$oh = $dimensions[1];
$largerval = max($ow, $oh);
$x = round(($oh * $sidemax) / $ow);
if ($largerval == $ow)
{
$nw = $x;
$nh = $sidemax;
} else {
$nw = $sidemax;
$nh = $x;
}
$thumbie = imagecreatetruecolor($nw, $nh);
if (!imagejpeg($thumbie, $thumbnailName))
{
$error = 'Error creating jpeg.';
include $_SERVER['DOCUMENT_ROOT'] . 'error.html.php';
exit();
}
$thumbnail[0] = imagecopyresampled($thumbnailName, $originalImage, 0, 0, 0, 0, $nw, $nh, $ow, $oh);
$thumbnail[1] = $thumbnailName;
return $thumbnail;
}
The error message I'm getting is this:
Line 63 is the one with the imagecopyresampled function on it.Warning: imagecopyresampled(): supplied argument is not a valid Image resource in [.......]\filewriting.inc.php on line 63







Aaaaaaaargggggggg.... I have to reinstall it all, don't I?


Bookmarks