Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot save image with PHP?
    primarykey
    data
    text
    <p>I am trying to take a user uploaded file, resize, and fill any empty section with white using this premade code snipit I found <a href="http://atwebresults.com/forum/viewtopic.php?f=25&amp;t=391" rel="nofollow">here</a>. It seems to be working fine until I attempt to write the code with the below code:</p> <p>Since this may be a problem with file permissions, the absolute path I am saving to is <code>http://test.local/uploads</code> and the script is running from <code>http://test.local/library/ajaxupload.php</code>.</p> <pre><code>$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; } </code></pre> <p><strong>Edit:</strong> OK, following the below instructions I got the error message. It is that the folder doesn't exist or permission is denied.</p> <p>The folder does indeed exist...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload