I have now spent several hours trying to figure this out.
I have this function to take an image on the server,copy it, resize it, and save it in a temporary location.
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).
I have tried all kinds of stuff, adding server root etc...
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?
The function I am referring to is at bottom of the code, imagejpeg();
Here is the function (shortened):
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<=$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);
}}
Thanks