if ($info[0] > 2999 and $info[1] < 2999) {
$img = imagescale($image, 1500); //resize
} else if ($info[0] < 2999 and $info[1] > 2999) {
$img = imagescale($image, 1500); //resize
} else if ($info[0] > 2999 and $info[1] > 2999) {
$img = imagescale($image, 1500); //resize
} else if ($info[0] < 2999 and $info[1] < 2999) {
$img = $image;
}
https://jsfiddle.net/raogueqb/1/