$imageInfo = pathinfo($urls[$rand]); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($urls[$rand]); header("Location: $urls[$rand]");