// copy resized image to new canvas imagecopyresampled ($dst, $src, 0, 0, $offsetX, $offsetY, $tn_width, $tn_height, $width, $height);