<style> .XX{ max-width:250px; height:auto; } </style> <body> <table width="500px;" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" > <DIV><img src="URL" class="XX"/></DIV> <DIV><img src="URL" class="XX" /></DIV> </td> <td valign="top" > <DIV><img src="URL" class="XX" /></DIV> <DIV><img src="URL" class="XX" /></DIV> </td> </tr> </table>
<div align="center"> <? $strSQL = "SELECT * FROM pic"; $objQuery = mysql_query($strSQL); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 20; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by id desc LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { $idg = $objResult["id"]; $topicg = $objResult["topic"]; $photog = $objResult["photo"]; echo "<td>"; $intRows++; ?> <table width="162" border="0" align="center" cellpadding="1" cellspacing="1" class="brdc"> <tr> <td width="102" height="21" align="center"> <? echo "<img src=picimg/$photog width=170 border=0>"; ?> </td> </tr> <tr> <td align="center"> <div align="left"> <? echo "<font size=2 color=#666666>$topicg</font>"; ?> </div></td> </tr> </table> <div align="left"> </div> </div> <div align="center"> <? echo"</td>"; if(($intRows)%4==0) { echo"</tr>"; } } echo"</tr></table>"; ?> </div>
<div align="center"> <? $strSQL = "SELECT * FROM pic"; $objQuery = mysql_query($strSQL); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 21; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by id desc LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { $idg = $objResult["id"]; $topicg = $objResult["topic"]; $photog = $objResult["photo"]; if(($intRows)%7==0) { echo"<td valign='top' >"; } ?> <table width="162" border="0" align="center" cellpadding="1" cellspacing="1" class="brdc"> <tr> <td width="102" height="21" align="center"> <? echo "<img src=picimg/$photog width=170 border=0>"; ?> </td> </tr> <tr> <td align="center"> <div align="left"> <? echo "<font size=2 color=#666666>$topicg</font>"; ?> </div></td> </tr> </table> <div align="left"> </div> </div> <div align="center"> <? //ขอตัดส่วนปิดTD ออกก่อนขี้เกียจคิด(อันที่จริงไม่ใส่ก็ได้) แต่เพื่อความสมบูรณ์ของ HTML ค่อยมาเติมเอาทีหลัง //if(($intRows)%7==0) //{ // echo"</td>"; //} $intRows++; } echo"</tr></table>"; ?> </div>
$td=array(); // ใช้เก็บ html แต่ละแถว $col=5; // อยากได้กี่คอลัมน์ก็กำหนดเอา $row=4; // อยากได้กี่ภาพต่อคอลัมน์กำหนดเอา $w=100; // ความกว้างของ image $idx=0; // กำหนดค่าเริ่มต้นที่ คอลัมน์ 0 $rs=msyql_query('select id from tb limit '.($col*$row)); while($ro=mysql_fetch_assoc($rs)){ $td[$idx].="<img src='image_[$ro[id]].jpg' width=$w /><br />"; $idx=($idx +1) ^ $col; } echo "<table><tr>"; for($i=0; $i<$col; $i++) echo "<td>$td[$i]</td>"; echo '</tr></table>';
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง