Cannot save image with PHP? -
i trying take user uploaded file, resize, , fill empty section white using premade code snipit found here. seems working fine until attempt write code below code:
since may problem file permissions, absolute path saving http://test.local/uploads
, script running http://test.local/library/ajaxupload.php
.
$save = '../uploads/' . $filename; $image_p = imagecreatetruecolor($fwidth, $blank_height); $white = imagecolorallocate($image_p, $colorr, $colorg, $colorb); imagefill($image_p, 0, 0, $white); switch($filetype){ case "gif": $image = @imagecreatefromgif($_files[$filename]['tmp_name']); break; case "jpg": $image = @imagecreatefromjpeg($_files[$filename]['tmp_name']); break; case "jpeg": $image = @imagecreatefromjpeg($_files[$filename]['tmp_name']); break; case "png": $image = @imagecreatefrompng($_files[$filename]['tmp_name']); break; } @imagecopyresampled($image_p, $image, 0, $top_offset, 0, 0, $fwidth, $fheight, $width_orig, $height_orig); switch($filetype){ case "gif": if(!@imagegif($image_p, $save)){ $errorlist[]= "permission denied [gif]"; } break; case "jpg": if(!@imagejpeg($image_p, $save, 100)){ $errorlist[]= "permission denied [jpg]"; } break; case "jpeg": if(!@imagejpeg($image_p, $save, 100)){ $errorlist[]= "permission denied [jpeg]"; } break; case "png": if(!@imagepng($image_p, $save, 0)){ $errorlist[]= "permission denied [png]"; } break; }
edit: ok, following below instructions got error message. folder doesn't exist or permission denied.
the folder indeed exist...
Comments
Post a Comment