In other words, imagecopyresampled() will take a rectangular area from imagecopyresampled ($im2,$im1,0,0,0,0,$w1,$h1,$w2,$h2); I wrote to resize images to a maximum dimension - based on what facebook does in the galleries..