Hello,
i have a problem with this code, i am resizing an image twice on upload and trying to move the two files into different directories. I have been trying to use chdir but because of safe mode it doesnt work. Will move_uploaded_file still do this after the file has been resized since it requires $userfile? I have tried but i am not sure what i am doing,
I Would really apppreciate any help or suggestions..
function do_upload($userfile,$image_name) {
$file = basename($userfile);
$img_data=getimagesize($userfile);
$src_w=$img_data[0];
$src_h=$img_data[1];
$src_img2=ImageCreateFromJPEG($userfile) or die ("Cannot open source");
if ($src_w < $src_h) {
$new_wl = 240;
$new_hl = 360;}
else {
$new_wl = 360;
$new_hl = 240; }
$dst_img2=imagecreate($new_wl,$new_hl);
imagecopyresized($dst_img2,$src_img2, 0, 0, 0, 0, $new_wl, $new_hl, $src_w, $src_h);
imagejpeg($dst_img2,$image_name);
move_uploaded_file ( $image_name, "/realdocs/gl/stock/");
ImageDestroy($src_img2);
ImageDestroy($dst_img2);
}