leszer Posted February 25, 2015 Share Posted February 25, 2015 Hi and thanks for the help ahead of time. I've changed this code about 25 times and I'm sure I'm missing something simple but all I get are issues and I'm not sure if it's me or Yahoo hosting. This is my code, all I'm doing is pulling images from a directory with a glob and trying to output them into a table with 2 columns that grows if necessary. Maybe someone has a better way altogether, I'm happily open to learning new ways to do things. I think I'm simply too close to the project at this point. Thanks again. <?php $folder = 'images/'; $filetype = '*.*'; $files = glob($folder.$filetype); $count = 0; $count = count($files); $cols = 2; echo '<table width="100%" cellspacing="3"><tr>'; foreach($files as $file) { if($count %$cols == 0) echo '</tr><tr><td colspan="2"><hr /></td></tr><tr>'; echo '<td align="center"><img src="' . $file '" /></a></td>'; $count++; } echo '</table>' . "\r\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/ Share on other sites More sharing options...
requinix Posted February 25, 2015 Share Posted February 25, 2015 What exactly is "issues"? You get a line at the top of the table? The first image is in the right column instead of the left? Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/#findComment-1506658 Share on other sites More sharing options...
leszer Posted February 25, 2015 Author Share Posted February 25, 2015 Issues as in either a blank screen or 500 - Internal Server Error. Now, if I don't try to pass the glob into a table I can view the images in a straight line down the page. Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/#findComment-1506664 Share on other sites More sharing options...
Solution requinix Posted February 25, 2015 Solution Share Posted February 25, 2015 A blank screen (aka the White Screen of Death) is typically caused by a syntax error. Check your code to see if there are any mistakes. Such as missing a . concatenation. Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/#findComment-1506675 Share on other sites More sharing options...
ginerjm Posted February 25, 2015 Share Posted February 25, 2015 And be sure that you have php error checking turned on. (See my signature) Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/#findComment-1506708 Share on other sites More sharing options...
leszer Posted February 25, 2015 Author Share Posted February 25, 2015 Yep, knew I was going to feel like an idiot when I got the reply that fixed it. Like I said, I was just too close to it and I'd messed with the code so many times. I got it just about right and missed the stupid "." Quote Link to comment https://forums.phpfreaks.com/topic/294880-sending-a-glob-of-images-into-columned-table/#findComment-1506736 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.