I am just testing a fragment of code from a project I am working on. Below is the snippet that is giving me problems. I thought it was because I did't have the gd lib, but after checking I did have that installed. I am stumped. Can someone look at this and help me out? It does copy the file to the images directory but it won't resize and copy the resized image. Help!!!
$userfile came from textbox form
<?php
//-----------this part works----------------
//COPY TO DIR
$dst = "/var/www/html/test/images/".$userfile_name;
if (!copy($userfile, $dst))
{
echo "Could not upload file, please try again later. If problem persists contact your network administrator";
}
//---------------this part does not---------------
//RESIZE THE IMAGE
$size = GetImageSize($userfile);
$im_in = ImageCreateFromJPEG($userfile);
$new_width = 200; //CHANGE IF NEEDED
$new_height = $new_width*($size[1]/$size[0]);
$im_out = ImageCreate($new_width, $new_height);
//SAVE TO THUMBNAIL DIR
ImageCopyResized($im_out, $im_in, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]);
//FREE MEMORY
ImageDestroy($im_in);
ImageDestroy($im_out);
print (phpinfo());
?>