I am having a problem with this script I found. Its a resize image script. There comes up when it gets the bottom and tries and saves the image file. It says something like
this....
Warning: imagejpeg(): Unable to open 'fiepath/image.jpg' for writing in the server path was here on line ...
Here is the code...
Please help if you can.
function resize_image($picPath, $resizedPath, $maxWidth, $maxHeight)
{
if (!$max_width) {
$max_width = '250';
}
if (!$max_height) {
$max_height = '150';
}
$size = GetImageSize($picPath);
echo $size."<br>";
$width = $size[0];
$height = $size[1];
echo $width."<br>";
echo $height."<br>";
$x_perc = $max_width / $width;
$y_perc = $max_height/ $height;
if ( ($width <= $max_width) && ($height <= $max_height)) {
$tn_width = $width;
$tn_height = $height;
}
else if ( ($x_perc * $height) < $max_height) {
$tn_height = ceil($x_perc * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_perc * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($picPath);
$dst = ImageCreateTrueColor($tn_width, $tn_height);
echo $src."<br>";
echo $dst."<br>";
ImageCopyResampled($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
ImageJpeg($dst, $resizedPath);
ImageDestroy($src);
ImageDestroy($dst);
}
resize_image("$imagePath/img.jpg", "$distinationPath/img.jpg", 250, 175);