Can someone please tell me what's wrong with this code. Rename does not work, copy does not work either. The idea os to move the files from the folder 'pictures' to the folder 'liggande' or 'staende' depending on width and height of the image. The logic works but no files are moved or copied. I'm on Mac OS X, latest version.
<?php
$mydir = dir('pictures');
while(($file = $mydir->read()) !== false)
{
echo "Filename: $file";
echo "<BR>";
list($width, $height, $type, $attr) = getimagesize("pictures/".$file);
echo "Width: " .$width;
echo "<BR>";
echo "Height: " .$height;
echo "<BR>";
if($width > $height)
{
echo "liggande";
//rename("pictures/".$file, "liggande/".$file);
copy("pictures/".$file, "liggande/".$file);
}
else
{
echo "staende";
//rename("pictures/".$file, "staende/".$file);
copy("pictures/".$file, "staende/".$file);
}
echo "<BR>";
echo "<BR>";
}
?>