preg_replace( '#<img[^>]*src="([^"]+)"[^>]*width="([^*]+)"[^>]*alt="([^* ]+)"[^>]*>#isU', '<a href="$1" rel="lightbox"><img src="$1" width="$2" alt="$3"></a>', $string
$string = '<img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-1.jpg" alt="" width="160" /> <img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-2.jpg" alt="" height="107" /> <img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-3.jpg" alt="" height="107" /><img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-4.jpg" alt="" width="160" /> <img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-6.jpg" alt="" height="120" /> <img src="http://ladafwd.ck.ua/wp-content/uploads/2011/07/lADA-LUKOIL-18.jpg" alt="" height="120" />';preg_match_all('/\<img src=\"(.*)\"/isU', $string, $match);foreach($match[1] as $value){ $pattern = '/<img src="/'; $replace = '<a href="'.$value.'"><img src="'; }$text = preg_replace($pattern, $replace, $string);$pattern2 = '/" \/>/';$replace2 = '" /></a>';$result = preg_replace($pattern2, $replace2, $text);echo $result;
ErrorDocument 401 /401.html ErrorDocument 403 /403.html ErrorDocument 404 /404.html