Code: 
$file = gzfile('yourfile.gz');
$file = implode("\n",$file);

$matches = array(
    array('rapidshare.png', '[url=http://rapidshare'),
    array('megaupload.png', '[url=http://megaupload')
);

foreach($matches as $match) {
    if(strpos($file, $match[1]) !== false) {
        $image = $match[0];
        break;
    }
}
Something like this maybe.

This is assuming your gz file is purely a gzipped text file, not a tar.gz for example.