 |
ใช้ ข้อมูลจาก db ยังไงครับ ไม่ทราบว่าจะเปลี่ยนเป็นใช้ ข้อมูลจาก db ยังไงครับ |
|
 |
|
|
 |
 |
|
เห็นโพสไว้นานแล้วไงก็ลองดูแล้วกัน
Code (PHP)
/* Configuration Start */
$thumb_directory = 'img/thumbs';
$orig_directory = 'img/original';
$stage_width=600; // How big is the area the images are scattered on
$stage_height=400;
/* Configuration end */
$allowed_types=array('jpg','jpeg','gif','png');
$file_parts=array();
$ext='';
$title='';
$i=0;
include("connect_db.php");
$sql="select * from table";
if($query=@mysql_query($sql)){
while($rs= @mysql_fetch_array($query)){
$left=rand(0,$stage_width);
$top=rand(0,400);
$rot = rand(-40,40);
if($top>$stage_height-130 && $left > $stage_width-230)
{
/* Prevent the images from hiding the drop box */
$top-=120+130;
$left-=230;
}
/* Outputting each image: */
echo '
<div id="pic-'.($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$sr["ฟิวชื่อรูป"].') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
<a class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$sr["ฟิวชื่อรูป"].'" target="_blank">'.$title.'</a>
</div>';
}
}else echo "Can't query sql";
ประมาณนี้อ่ะมั้งแหะๆ
|
 |
 |
 |
 |
Date :
2010-07-19 12:36:31 |
By :
Chineji |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
น่าจะตกตัวแปล $title = ชื่อรูปจาก DB จับมาใส่เองแล้วกัน 
|
 |
 |
 |
 |
Date :
2010-07-19 12:39:48 |
By :
Chineji |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|