redarrow Posted March 12, 2013 Share Posted March 12, 2013 <?php // image written like my_name_is(1).jpg $dirname = "kenai_river_fishing_images/"; $images = glob($dirname."*"); $img=preg_replace('/[\(\)]+/','',$images); foreach($img as $image) { echo '<img src="'.$image.'" /><br />'; } ?> the image files are in this format. // image written like my_name_is(1).jpg so i used the above code to get rid of the ( <<< )<<<< signs now the image says this kenai_river_fishing 1.JPG as you can see there gaps so the images wont show what do i do cheers. Quote Link to comment https://forums.phpfreaks.com/topic/275554-what-going-on-please-help-preg_replace/ Share on other sites More sharing options...
redarrow Posted March 12, 2013 Author Share Posted March 12, 2013 (edited) <?php // image written like my_name_is(1).jpg $dirname = "kenai_river_fishing_images/"; $images = glob($dirname."*"); $imgs=preg_replace('/[\(\)]+/','',($images)); $imgss = preg_replace('/\s+/', '', $imgs); foreach($imgss as $image) { echo '<img src="'.$image.'" /><br />'; } ?> still not working even thu the problam fixed Edited March 12, 2013 by redarrow Quote Link to comment https://forums.phpfreaks.com/topic/275554-what-going-on-please-help-preg_replace/#findComment-1418203 Share on other sites More sharing options...
OleKh Posted March 12, 2013 Share Posted March 12, 2013 $images = glob($dirname."*"); print_r($images); What will output? Quote Link to comment https://forums.phpfreaks.com/topic/275554-what-going-on-please-help-preg_replace/#findComment-1418207 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.