Matthew T
2013-01-30 13:38:16 UTC
The script all works and the copies are made accept after the form is submitted I get the following error message even though the script works and copies are created, any ideas?
Error Message: Warning: imagejpeg() [function.imagejpeg]: Unable to open 'Members/118/' for writing: Is a directory in /home/mattthor/public_html/fitnetwork.co.uk/PHPScripts/ak_php_img_lib_1.0.php on line 26
Script in question:
// ----------------------- RESIZE FUNCTION -----------------------
// Function for resizing any jpg, gif, or png image files
function ak_img_resize($target, $newcopy, $w, $h, $ext) {
list($w_orig, $h_orig) = getimagesize($target);
$img = "";
$ext = strtolower($ext);
if ($ext == "gif"){
$img = imagecreatefromgif($target);
} else if($ext =="png"){
$img = imagecreatefrompng($target);
} else {
$img = imagecreatefromjpeg($target);
}
$tci = imagecreatetruecolor($w, $h);
imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
if ($ext == "gif"){
$img = imagegif($tci, $newcopy);
} else if($ext =="png"){
$img = imagepng($tci, $newcopy);
} else {
$img = imagejpeg($tci, $newcopy, 84);
}
}
?>