if( preg_match('/\.png|\.jpg|\.jpeg/i', $src) && !preg_match('/ebaystatic|sprites/i', $src) ) { if(preg_match('/(ebayimg).+(s-l300)/', $src)) $src = str_replace('s-l300', 's-l500', $src); // substitutes ebay image url with a width of 300px to 500px // preg_replace('/^(.+?)(\?.*?)?(#.*)?$/', '$1$3', $src); // deletes GET parameter $images[] = $src; }