Hello,
I have been trying to resize and move images on upload and have been using chdir to change dir, which works fone locally but doesnt work on the host, because of safe mode I presume. So now I am trying to get move_uploaded_file to do the business. Can someone take a wee look at this and tell me what I am doing wrong, I read somewhere that the $userfile name is the one that is supposed to be in this function but since I am resizing twice and dont want the original image, but the copies of it, does this effect the function to the point of not working?? Thanks
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);
}