No matter what I do, this PHP function wont find the directory, why?
<p>I have now spent several hours trying to figure this out.</p>

<p>I have this function to take an image on the server,copy it, resize it, and save it in a temporary location.</p>

<p>The function works and is tested inside another php file.
But THIS PHP FILE refuse to find the folder '../temp_images' (you can see it in the variable $temp_path).</p>

<p>I have tried all kinds of stuff, adding server root etc...</p>

<p><strong>Does anybody know why this function cant find the path to the directory in this php file, but it can in another php file in the same folder?</strong>
The function I am referring to is at bottom of the code, <code>imagejpeg();</code></p>

<p>Here is the function (shortened):</p>

<pre><code>function show_pics($tot_pics, $id_string, $category){

     $ad_id_stripped = end( explode( '_', $id_string ) );
     $img_path="SV/main/ad_images/$category/";
     $temp_path="../temp_images/remove_images/";
     $maxH = 70;
     $maxW = 93;
      $top_offset = 0;
     for ($i=1; $i&lt;=$tot_pics; $i++){

         $image_p = imagecreatetruecolor($fwidth, $blank_height);
                     $white = imagecolorallocate($image_p, 255, 255, 255);
                     imagefill($image_p, 0, 0, $white);

         $image = imagecreatefromjpeg('../ad_images/'.$category.'/'.$ad_id_stripped.'_'.$i.'.jpg');

         imagecopyresampled($image_p, $image, 0, $top_offset, 0, 0, $fwidth, $fheight, $width_orig, $height_orig);

         imagejpeg($image_p, $temp_path, 100);


     }}
</code></pre>

<p>Thanks</p>
