akumakeenta Posted March 7, 2010 Share Posted March 7, 2010 Hi all again, I have a script that will process all images and place them all in one row. What I need help with is, to place to 2 images in one row and then start a new row and place two more images etc. Here is the code: <table cellpadding="5" class="adpics" width="100%" border="0"> <tr> <?php while ($row = mysql_fetch_array($pres)) { $i++; $imgsize = GetThumbnailSize("{$datadir[adpics]}/{$row[picfile]}", $images_max_width, $images_max_height); ?> <td> <img src="<?php echo "{$datadir[adpics]}/{$row[picfile]}"; ?>" id="adimg<?php echo $i; ?>" width="<?php echo $imgsize[0]; ?>" height="<?php echo $imgsize[1]; ?>"> </td> <?php } ?> </tr> </table> thanks again for your help. Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/ Share on other sites More sharing options...
trq Posted March 7, 2010 Share Posted March 7, 2010 See here. Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/#findComment-1022561 Share on other sites More sharing options...
akumakeenta Posted March 7, 2010 Author Share Posted March 7, 2010 Thanks I hope i can figure it out...I was just hoping for someone to just say type this....lol Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/#findComment-1022564 Share on other sites More sharing options...
vividona Posted March 7, 2010 Share Posted March 7, 2010 $count = 1; $column = 1; echo '<table cellpadding="5" class="adpics" width="100%" border="0">'; while ($row = mysql_fetch_array($pres)) { if ($column == 1){ echo "<tr> <td>".$imgsize = GetThumbnailSize("{$datadir[adpics]}/{$row[picfile]}", $images_max_width, $images_max_height)."</td>"; }else{ echo "<td>".$imgsize = GetThumbnailSize("{$datadir[adpics]}/{$row[picfile]}", $images_max_width, $images_max_height)."</td>";("<td></tr>"; } } $count += 1; $column = $count % 2; Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/#findComment-1022565 Share on other sites More sharing options...
trq Posted March 7, 2010 Share Posted March 7, 2010 Thanks I hope i can figure it out...I was just hoping for someone to just say type this....lol That's pretty much what that mini tutorial does, and you get to learn how its done. Save you coming back again latter and asking the same question. Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/#findComment-1022567 Share on other sites More sharing options...
akumakeenta Posted March 7, 2010 Author Share Posted March 7, 2010 I tried to write it myself by the link you sent me to but I didn't work. I didn't get any errors which is a win in my book. LOL but I will try Vividona's suggestion. Thanks all. I'll keep you posted. Link to comment https://forums.phpfreaks.com/topic/194395-if-statement-to-arrange-images/#findComment-1022569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.