ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comไทย เสียว บอร์ดTutorial (ห้ามตั้งคำถามห้องนี้)เปิดซิงกับ Tutorial :AdSense Ad Positioning แบบไอคอนภาพสุ่ม
หน้า: 1 2 [ทั้งหมด]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: เปิดซิงกับ Tutorial :AdSense Ad Positioning แบบไอคอนภาพสุ่ม  (อ่าน 12388 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
munich
สมุนแก๊งเสียว
*

พลังน้ำใจ: 4
ออฟไลน์ ออฟไลน์

กระทู้: 845



ดูรายละเอียด
« เมื่อ: 03 ตุลาคม 2006, 18:26:00 »

แบบเด็กๆน่ะครับ เหมาะกับมือใหม่ เซียนๆข้ามไปได้เลย :lol:  :lol:

ป.ล. กรุณาอ่านกระทู้นี้ เนื่องจากมีกฏกำหนดเรื่องนี้ออกมาแล้ว (bubbleball 21-12-06)
http://www.thaiseoboard.com/viewtopic.php?t=3963


ผลลัพธ์ 1


ผลลัพธ์ 2


1.สร้างภาพตรึงไว้เป็นเหมือน Icon หรือ Thumbnail ให้ดูเหมือนเป็นภาพเล็กๆสวยๆ 4 ภาพ (แต่จริงๆคือไฟล์ภาพเดียวกัน) ขนาด 90x280 pixels สำหรับเอามาใช้สุ่ม จะสร้างสัก 2-3 ชุดก็ตามแต่ จัดวางเลย์เอ้าก็กะเอาราวๆนี้ ถ้าไม่มีก็หาเอา icon สวยๆมาแต่งโหลดเอาจากที่นี่ครับ
http://www.maxpower.ca/free-icons/2006/03/05/

2.ใช้สคริปต์สำหรับเปลี่ยนภาพในข้อ 1 เวลาดาวน์โหลดมาใช้อย่าลืมเปลี่ยนเป็น rotate.php ด้วยครับ
http://www.alistapart.com/d/randomizer/rotate.txt

3.สร้าง Folder สำหรับเก็บภาพทั้งหมดเอาไว้ที่โฮสต์ อย่าลืมเอาสคริปต์ rotate.php ใส่ไว้ด้านในด้วย

คือ image1, image2, image3 (ภาพในข้อที่ 1) และไฟลฺ์ rotate.php จัดเก็บอยู่ในโฟลเดอร์เดียวกัน

4.ใช้ table หรือ css สำหรับใส่รูปภาพในข้อที่ 1 และโค้ด Adsense จัดวาง layout ให้เหมาะสมในไฟล์เพจที่เราต้องการแสดงโฆษณาแล้วบันทึก

ตัวอย่าง table code

โค๊ด:

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.johntp.com/adsense/rotate.php" width="90" height="280"/></td>
<td>
<script type="text/javascript"><!--
google_ad_client = "AdSense ID ของเราเอง";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_ad_channel ="8617624486";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "3D81EE";
google_color_text = "000000";
google_color_url = "3D81EE";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>


ขนาดหรือ scale ปรับหรือประยุกต์กันเอาเองน่ะครับ ไฟล์ภาพที่จะเอามาใช้ก็ให้ใกล้เคียงกับ Ad ที่จะขึ้น เช่น Content ด้านท่องเที่ยวก็ใส่ภาพทิวทัศน์ ภูเขา หรือทะเล แค่นี้ น่าจะได้คลิกเยอะเหมือนกันน่ะครับ ถ้าไม่ Random ภาพก็ยัดภาพใส่ตรงๆไม่ต้องใช้ โค้ดให้วุ่นวายน่ะครับ

เครดิตจากเว็บนี้ น่ะครับ ลอกเค้ามา  :lol:  :lol:
บันทึกการเข้า
tony
เกี๊ยวหวาน
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 4,079



ดูรายละเอียด
« ตอบ #1 เมื่อ: 03 ตุลาคม 2006, 18:28:37 »

ผมกำลังเลิกใช้เทคนิคนี้ ฮาาาา

ใช้เทคนิคเนียนๆ อย่างอื่นอยู่ ลองดู
บันทึกการเข้า

ไม่ค่อยว่างมาดูเท่าไร แต่หัวใจยังกิ๊ดตึ๋ง
munich
สมุนแก๊งเสียว
*

พลังน้ำใจ: 4
ออฟไลน์ ออฟไลน์

กระทู้: 845



ดูรายละเอียด
« ตอบ #2 เมื่อ: 03 ตุลาคม 2006, 18:31:24 »

เทคนิคไรหว่า บอกได้เปล่า
บันทึกการเข้า
7
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 16
ออฟไลน์ ออฟไลน์

กระทู้: 1,353



ดูรายละเอียด เว็บไซต์
« ตอบ #3 เมื่อ: 03 ตุลาคม 2006, 19:18:13 »

คุณ tony เทคนิคนี้มีข้อเสียอย่างไรฤา ทั้งวางภาพไว้ข้างหน้าหรือข้างหลัง
บันทึกการเข้า

iamnewbies
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 28
ออฟไลน์ ออฟไลน์

กระทู้: 9,635



ดูรายละเอียด
« ตอบ #4 เมื่อ: 03 ตุลาคม 2006, 19:33:55 »

PM บอกผมหน่อยจิคุณ tony อิอิ
บันทึกการเข้า

ุอิอิ  พลุบๆโพล่ๆ  เข้าๆออกๆ เสียวๆ
Yut!
Administrator
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 192
ออฟไลน์ ออฟไลน์

กระทู้: 1,642



ดูรายละเอียด
« ตอบ #5 เมื่อ: 03 ตุลาคม 2006, 19:37:08 »

บอกผมด้วยนะ  :oops:
บันทึกการเข้า

jane
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 25
ออฟไลน์ ออฟไลน์

กระทู้: 1,265



ดูรายละเอียด
« ตอบ #6 เมื่อ: 03 ตุลาคม 2006, 19:47:55 »

ขอ..ด้วยคนค่ะ :wink:
บันทึกการเข้า

antitrust
ก๊วนเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 301



ดูรายละเอียด
« ตอบ #7 เมื่อ: 03 ตุลาคม 2006, 20:19:23 »

ขอผมด้วยนะคร๊าบ พี่ tony  Cheesy
บันทึกการเข้า

มือใหม่หัดขับ...google
tony
เกี๊ยวหวาน
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 4,079



ดูรายละเอียด
« ตอบ #8 เมื่อ: 03 ตุลาคม 2006, 20:37:48 »

กำ  มันอยู่ในช่วงทดสอบบบบบ อย่าเพิ่งเสะ :lol:


เออ ผมว่า เทคนิคนี้ มีข้อเสียคือ
- เวลาโฆษณามาไม่เต็ม ตัวหนังสือมันจะใหญ่ขึ้น แล้ว รูปมันจะไม่ตรงกับหัวข้อโฆษณา ดูแล้วรู้ว่า "มันเอามาใส่ไว้ทำไม" หรือไม่ก็ "ดูพิลึกๆ" ถ้าเป็นคนทำ adsense ก็จะคิดว่า "มันจะหลอกกูคลิกรึ"

- แล้วเอามาใส่ มันจะทำให้ เว็บคุณดูแปลกๆ ไป ลองสังเกตสิ
ยิ่งหารูปมาใส่ เป็นกรอบสี่เหลี่ยม สี่อัน ยิ่งแปลกๆ

คนทำได้ดี อาจจะดีไป คนทำไม่ดีนี่ เอ่อ... อาจจะค่อนไปทางซวย
บันทึกการเข้า

ไม่ค่อยว่างมาดูเท่าไร แต่หัวใจยังกิ๊ดตึ๋ง
benze
สมุนแก๊งเสียว
*

พลังน้ำใจ: 1
ออฟไลน์ ออฟไลน์

กระทู้: 972



ดูรายละเอียด
« ตอบ #9 เมื่อ: 03 ตุลาคม 2006, 20:39:38 »

บอกผมด้วยนะ
บันทึกการเข้า
kittop
Verified Seller
สมุนแก๊งเสียว
*

พลังน้ำใจ: 27
ออฟไลน์ ออฟไลน์

กระทู้: 755



ดูรายละเอียด
« ตอบ #10 เมื่อ: 03 ตุลาคม 2006, 20:49:58 »

ขอด้วยละกันครับ
อยากรู้เช่นกัน
บันทึกการเข้า

blogger
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 11
ออฟไลน์ ออฟไลน์

กระทู้: 1,443



ดูรายละเอียด เว็บไซต์
« ตอบ #11 เมื่อ: 03 ตุลาคม 2006, 21:50:20 »

ไม่ควรใส่กรอบนะครับจะได้เนียนขึ้น แต่ใส่กรอบแล้วดีตรงที่ปลอดภัยจาก gg ครับ

ทำวิธีนี้ ctr เพิ่ม 2-3 เท่าครับ ถือว่าโอนะครับ

คุณ tony jaa บอกไต๋บางดิ thank you
บันทึกการเข้า

~+@@ ^^ แอบรักน้องผึ้งนะ ^^@@+~

ฟังเพลง
Glitter
ร้อง คาราโอเกะ ออนไลน์
bubbleball
Administrator
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 444
ออฟไลน์ ออฟไลน์

กระทู้: 5,695



ดูรายละเอียด
« ตอบ #12 เมื่อ: 03 ตุลาคม 2006, 21:50:55 »

ผมกะเก็บเป็น xml แล้วดึงใส่ flash มาแสดงผลเอาเลย แต่ไม่ใช่ภาพเรื่อยเปื่อยนะครับ เป็นภาพจากใน blog แต่ละ post นี่แหละ  Shocked

วิธีนี้ได้ผลแน่นอนครับ ลองดู ตะกี้ผมเพิ่งได้ 2 คลิก 0.62 ดอล  Cheesy  วันก่อนกระแดะลองเอาออก ลดให้เหลือ ad อันเดียวด้านบนสุด ไม่มีคนคลิกเลย เหอๆ
บันทึกการเข้า

กลุ่มซื้อขายบริการเกี่ยวกับ SEO อื่นๆ โดยตรง
SEO MARKET THAILAND

สงสัยติดต่ออะไรไปทักหาที่ Fair Thailand (ไม่ค่อยอ่านกล่องข้อความที่นี่)

Fair Market Thailand   กลุ่มค้าขายรวมอื่นๆ ในภายหลัง


ปลาทอง
ลายเซนต์สูงไม่เกิน 250px
munich
สมุนแก๊งเสียว
*

พลังน้ำใจ: 4
ออฟไลน์ ออฟไลน์

กระทู้: 845



ดูรายละเอียด
« ตอบ #13 เมื่อ: 03 ตุลาคม 2006, 21:55:17 »

อ่า ขอวิธีคุณ bbball ด้วยครับ เผื่อจะจิ๊กวิชาบ้างครับ
บันทึกการเข้า
bubbleball
Administrator
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 444
ออฟไลน์ ออฟไลน์

กระทู้: 5,695



ดูรายละเอียด
« ตอบ #14 เมื่อ: 03 ตุลาคม 2006, 22:02:23 »

เดี๋ยวว่างก่อนนะครับ มันต้องเขียน action script ใน flash แต่หลักการก็โหลดไฟล์ xml มาแล้ว จับใส่อาเรย์แล้วแรนดอม url ของภาพออกมา 4 อัน หลังจากนั้นก็ใช้คำสั่งโหลดภาพ ใส่มูฟวี่คลิปที่วางไว้ 4 ตัว แค่นี้แหละครับ flash มันโหลดภาพจากภายนอกเข้ามาได้  Shocked

แต่ผลลัพธ์ก็คงไม่ต่างกันมากกับใช้ js หรอกครับ
บันทึกการเข้า

กลุ่มซื้อขายบริการเกี่ยวกับ SEO อื่นๆ โดยตรง
SEO MARKET THAILAND

สงสัยติดต่ออะไรไปทักหาที่ Fair Thailand (ไม่ค่อยอ่านกล่องข้อความที่นี่)

Fair Market Thailand   กลุ่มค้าขายรวมอื่นๆ ในภายหลัง


ปลาทอง
ลายเซนต์สูงไม่เกิน 250px
iamnewbies
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 28
ออฟไลน์ ออฟไลน์

กระทู้: 9,635



ดูรายละเอียด
« ตอบ #15 เมื่อ: 03 ตุลาคม 2006, 22:27:13 »

สำหรับคนที่ไม่เก่ง flash นะครับ

ผมว่าใช้ GIF Animation ก็ง่ายดีนะครับ คลาสสิกดี อิอิ
บันทึกการเข้า

ุอิอิ  พลุบๆโพล่ๆ  เข้าๆออกๆ เสียวๆ
Nongkhai_tong
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 236
ออฟไลน์ ออฟไลน์

กระทู้: 6,542



ดูรายละเอียด
« ตอบ #16 เมื่อ: 03 ตุลาคม 2006, 22:40:09 »

gif animation มันจะเปลี่ยนรูปเองน่ะคับ ดูไม่ค่อยเนี้ยนเท่าไหร่แต่ถ้าใช้สคริปนั้นก็ work ดีน่ะผมว่าอะ
บันทึกการเข้า

blogger
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 11
ออฟไลน์ ออฟไลน์

กระทู้: 1,443



ดูรายละเอียด เว็บไซต์
« ตอบ #17 เมื่อ: 04 ตุลาคม 2006, 18:40:14 »

แล้วจะหา file rotate.php ได้จากไหนครับ ผมลอง save rotate.txt มา แต่พอเปลี่ยนเป็น php มันดันเป้น rotate.php.txt อะคับ
บันทึกการเข้า

~+@@ ^^ แอบรักน้องผึ้งนะ ^^@@+~

ฟังเพลง
Glitter
ร้อง คาราโอเกะ ออนไลน์
Nongkhai_tong
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 236
ออฟไลน์ ออฟไลน์

กระทู้: 6,542



ดูรายละเอียด
« ตอบ #18 เมื่อ: 04 ตุลาคม 2006, 18:42:25 »

อ้างจาก: "blogger"
แล้วจะหา file rotate.php ได้จากไหนครับ ผมลอง save rotate.txt มา แต่พอเปลี่ยนเป็น php มันดันเป้น rotate.php.txt อะคับ


ง่าย ๆคับ ก็ copy โค๊ดที่อยู่ใน rotate.txt แล้วเปิด Dreamwever สร้างไฟล์ใหม่แล้วก็ past จากนั้นก็  save เป็น php ได้หนิคับ :lol:
บันทึกการเข้า

blogger
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 11
ออฟไลน์ ออฟไลน์

กระทู้: 1,443



ดูรายละเอียด เว็บไซต์
« ตอบ #19 เมื่อ: 04 ตุลาคม 2006, 19:01:18 »

อ้างจาก: "Nongkhai_tong"
อ้างจาก: "blogger"
แล้วจะหา file rotate.php ได้จากไหนครับ ผมลอง save rotate.txt มา แต่พอเปลี่ยนเป็น php มันดันเป้น rotate.php.txt อะคับ


ง่าย ๆคับ ก็ copy โค๊ดที่อยู่ใน rotate.txt แล้วเปิด Dreamwever สร้างไฟล์ใหม่แล้วก็ past จากนั้นก็  save เป็น php ได้หนิคับ :lol:


ขอบคุงคับ
บันทึกการเข้า

~+@@ ^^ แอบรักน้องผึ้งนะ ^^@@+~

ฟังเพลง
Glitter
ร้อง คาราโอเกะ ออนไลน์
jane
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 25
ออฟไลน์ ออฟไลน์

กระทู้: 1,265



ดูรายละเอียด
« ตอบ #20 เมื่อ: 29 ตุลาคม 2006, 00:31:33 »

อ้างจาก: "blogger"
ไม่ควรใส่กรอบนะครับจะได้เนียนขึ้น แต่ใส่กรอบแล้วดีตรงที่ปลอดภัยจาก gg ครับ
ทำวิธีนี้ ctr เพิ่ม 2-3 เท่าครับ ถือว่าโอนะครับ

คุณ tony jaa บอกไต๋บางดิ thank you


ถ้าไม่ใส่กรอบแล้วผิดกฎเหรอคะ  :?:  :roll:
พอดีกำลังทำแบบไม่ใส่กรอบอยู่น่ะค่ะ
บันทึกการเข้า

bubbleball
Administrator
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 444
ออฟไลน์ ออฟไลน์

กระทู้: 5,695



ดูรายละเอียด
« ตอบ #21 เมื่อ: 29 ตุลาคม 2006, 01:25:17 »

ถ้าไม่ใส่กรอบ ให้เว้นระยะพอประมาณกำลังดีครับ
บันทึกการเข้า

กลุ่มซื้อขายบริการเกี่ยวกับ SEO อื่นๆ โดยตรง
SEO MARKET THAILAND

สงสัยติดต่ออะไรไปทักหาที่ Fair Thailand (ไม่ค่อยอ่านกล่องข้อความที่นี่)

Fair Market Thailand   กลุ่มค้าขายรวมอื่นๆ ในภายหลัง


ปลาทอง
ลายเซนต์สูงไม่เกิน 250px
iamnewbies
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 28
ออฟไลน์ ออฟไลน์

กระทู้: 9,635



ดูรายละเอียด
« ตอบ #22 เมื่อ: 29 ตุลาคม 2006, 10:09:10 »

http://alistapart.com/articles/randomizer/

http://alistapart.com/d/randomizer/rotate.txt
บันทึกการเข้า

ุอิอิ  พลุบๆโพล่ๆ  เข้าๆออกๆ เสียวๆ
iamnewbies
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 28
ออฟไลน์ ออฟไลน์

กระทู้: 9,635



ดูรายละเอียด
« ตอบ #23 เมื่อ: 29 ตุลาคม 2006, 10:09:25 »

โค๊ด:

<?php

/*

AUTOMATIC IMAGE ROTATOR
Version 2.2 - December 4, 2003
Copyright &#40;c&#41; 2002-2003 Dan P. Benjamin, Automatic, Ltd.
All Rights Reserved.

http&#58;//www.hiveware.com/imagerotator.php

http&#58;//www.automaticlabs.com/


DISCLAIMER
Automatic, Ltd. makes no representations or warranties about
the suitability of the software, either express or
implied, including but not limited to the implied
warranties of merchantability, fitness for a particular
purpose, or non-infringement. Dan P. Benjamin and Automatic, Ltd.
shall not be liable for any damages suffered by licensee
as a result of using, modifying or distributing this
software or its derivatives.


ABOUT
This PHP script will randomly select an image file from a
folder of images on your webserver.  You can then link to it
as you would any standard image file and you'll see a random
image each time you reload.

When you want to add or remove images from the rotation-pool,
just add or remove them from the image rotation folder.


VERSION CHANGES
Version 1.0
- Release version

Version 1.5
- Tweaked a few boring bugs

Version 2.0
- Complete rewrite from the ground-up
- Made it clearer where to make modifications
- Made it easier to specify/change the rotation-folder
- Made it easier to specify/change supported image types
- Wrote better instructions and info &#40;you're them reading now&#41;
- Significant speed improvements
- More error checking
- Cleaner code &#40;albeit more PHP-specific&#41;
- Better/faster random number generation and file-type parsing
- Added a feature where the image to display can be specified
- Added a cool feature where, if an error occurs &#40;such as no
  images being found in the specified folder&#41; *and* you're
  lucky enough to have the GD libraries compiled into PHP on
  your webserver, we generate a replacement "error image" on
  the fly.

    Version 2.1
        - Updated a potential security flaw when value-matching
          filenames

    Version 2.2
        - Updated a few more potential security issues
        - Optimized the code a bit.
        - Expanded the doc for adding new mime/image types.

        Thanks to faithful ALA reader Justin Greer for
        lots of good tips and solid code contribution!


INSTRUCTIONS
1. Modify the $folder setting in the configuration section below.
2. Add image types if needed &#40;most users can ignore that part&#41;.
3. Upload this file &#40;rotate.php&#41; to your webserver.  I recommend
   uploading it to the same folder as your images.
4. Link to the file as you would any normal image file, like this&#58;

<img src="http&#58;//example.com/rotate.php">

5. You can also specify the image to display like this&#58;

<img src="http&#58;//example.com/rotate.php?img=gorilla.jpg">

This would specify that an image named "gorilla.jpg" located
in the image-rotation folder should be displayed.

That's it, you're done.

*/




/* ------------------------- CONFIGURATION -----------------------


Set $folder to the full path to the location of your images.
For example&#58; $folder = '/user/me/example.com/images/';
If the rotate.php file will be in the same folder as your
images then you should leave it set to $folder = '.';

*/


$folder '.';


/*

Most users can safely ignore this part.  If you're a programmer,
keep reading, if not, you're done.  Go get some coffee.

    If you'd like to enable additional image types other than
gif, jpg, and png, add a duplicate line to the section below
for the new image type.

Add the new file-type, single-quoted, inside brackets.

Add the mime-type to be sent to the browser, also single-quoted,
after the equal sign.

For example&#58;

PDF Files&#58;

$extList['pdf'&#93; = 'application/pdf';

    CSS Files&#58;

        $extList['css'&#93; = 'text/css';

    You can even serve up random HTML files&#58;

    $extList['html'&#93; = 'text/html';
    $extList['htm'&#93; = 'text/html';

    Just be sure your mime-type definition is correct!

*/

    
$extList = array&#40;&#41;;
$extList['gif'&#93; = 'image/gif';
$extList['jpg'&#93; = 'image/jpeg';
$extList['jpeg'&#93; = 'image/jpeg';
$extList['png'&#93; = 'image/png';


// You don't need to edit anything after this point.


// --------------------- END CONFIGURATION -----------------------

$img null;

if &
#40;substr&#40;$folder,-1&#41; != '/'&#41; &#123;
$folder $folder.'/';
&
#125;

if &#40;isset&#40;$_GET['img'&#93;&#41;&#41; &#123;
$imageInfo pathinfo&#40;$_GET['img'&#93;&#41;;
if &#40;
    isset&#40; $extList[ strtolower&#40; $imageInfo['extension'&#93; &#41; &#93; &#41; &&
        
file_exists&#40; $folder.$imageInfo['basename'&#93; &#41;
    
&#41; &#123;
$img $folder.$imageInfo['basename'&#93;;
&#125;
&#125; else &#123;
$fileList = array&#40;&#41;;
$handle opendir&#40;$folder&#41;;
while &#40; false !== &#40; $file = readdir&#40;$handle&#41; &#41; &#41; &#123;
$file_info pathinfo&#40;$file&#41;;
if &#40;
    isset&#40; $extList[ strtolower&#40; $file_info['extension'&#93; &#41; &#93; &#41;
&#41; &#123;
$fileList[&#93; = $file;
&#125;
&#125;
closedir&#40;$handle&#41;;

if &#40;count&#40;$fileList&#41; > 0&#41; &#123;
$imageNumber time&#40;&#41; % count&#40;$fileList&#41;;
$img $folder.$fileList[$imageNumber&#93;;
&#125;
&#125;

if &#40;$img!=null&#41; &#123;
$imageInfo pathinfo&#40;$img&#41;;
$contentType 'Content-type&#58; '.$extList$imageInfo['extension'&#93; &#93;;
header &#40;$contentType&#41;;
readfile&#40;$img&#41;;
&#125; else &#123;
if &#40; function_exists&#40;'imagecreate'&#41; &#41; &#123;
header &#40;"Content-type&#58; image/png"&#41;;
$im = @imagecreate &#40;100, 100&#41;
    or die &#40;"Cannot initialize new GD image stream"&#41;;
$background_color imagecolorallocate &#40;$im, 255, 255, 255&#41;;
$text_color imagecolorallocate &#40;$im, 0,0,0&#41;;
imagestring &#40;$im, 2, 5, 5,  "IMAGE ERROR", $text_color&#41;;
imagepng &#40;$im&#41;;
imagedestroy&#40;$im&#41;;
&#125;
&#125;

?>

บันทึกการเข้า

ุอิอิ  พลุบๆโพล่ๆ  เข้าๆออกๆ เสียวๆ
EThaiZone
เจ้าพ่อโลลิค่อน
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 321
ออฟไลน์ ออฟไลน์

กระทู้: 12,518



ดูรายละเอียด เว็บไซต์
« ตอบ #24 เมื่อ: 29 ธันวาคม 2006, 07:37:35 »

... จะเอายาวๆ ทำไมน้อครับ ในเมื่อสุ่มแค่รูปภาพนิ

โค๊ด:
<?php
//PHP Code &#58; Random Picture In Folder
//Writed by &#58; EThaiZone.Com
//Contact us &#58; [email protected]

//แก้เป็นชื่อโฟลเดอร์ที่เก็บรูปภาพ มี / ปิดท้ายด้วย
$path "images/adsense/";

$path2 realpath&#40;$path&#41;;
$flist opendir&#40;$path2&#41;;
$list = array&#40;&#41;;
while &#40;false !== &#40;$mfile = readdir&#40;$flist&#41;&#41;&#41; &#123;
$list array_merge&#40;&#40;array&#41;$list, &#40;array&#41;$mfile&#41;;
&#125;
sort&#40;$list&#41;;
array_splice&#40;$list, 0, 2&#41;;
$img =array_rand&#40;$list&#41;;
$img $list[$img&#93;;
header&#40;'Content-type&#58; image/jpeg'&#41;;
@readfile&#40;"$path$img"&#41;;
?>


วิธีใช้งานสุดๆ
แก้ $path ให้เป็นโฟลเดอร์ที่เก็บรูปภาพ ภายในนั้นต้องมีแต่ภาพนะครับ
(ผมเขียนให้สั้นที่สุด จึงไม่มีระบบเช็คนามสกุล)

แล้วก็ใช้งานได้เลย ตัวอย่าง  (ดูแล้วจะรุ้ว่าต้องอัพไฟล์ และใช้อย่างไร)
ip.ethaizone.com/picture.php
ip.ethaizone.com/images/adsense/

ไม่เห็นกระทู้นี้ ไม่งั้นก็เอาโค้ดมาโพสนานแล้ว
ความจริงเขียนไว้นานแล้วแหละ แต่ไม่นึกว่ามีคนคิดเหมือนกัน
บันทึกการเข้า

หน้า: 1 2 [ทั้งหมด]   ขึ้นบน
พิมพ์