หลังจากหา codeย่อรูปมานาน
เจอแต่ code ที่ย่อรูปแล้วรูปไม่ชัด
หรือย่อแล้วสัดส่วนผิด
ในที่สุดก็เจอของดี
PHP Thumbnailer Class v2.0 by Gen X Design
วิธีใช้ก็ง่ายๆ เพียงแค่ใส่ include ไฟล์เข้าไป
แล้วก็ new thumbnail เพื่อสร้าง object ของรูปที่เราจะย่อ
<?php
include_once('thumbnail.inc.php');
$thumb = new Thumbnail('path/to/image/file.jpg');
?>
กำหนดขนาดที่ต้องการจะย่อ ใส่ width, height เข้าไป
$thumb->resize($width,$height);
หรือสามารถใส่เป็น % ก็ได้
$thumb->resizePercent(50);
สั่งแสดงรูป
$thumb->show();
หรือสั่ง save
$thumb->save('path/to/file.jpg');
เท่านี้ก็จะได้รูปที่เราย่อแบบสวยงามแล้ว
Crop ภาพ
$thumb->cropFromCenter(100);
หรือทำให้รูปมีเงาสะท้อนก็ใช้คำสั่ง
$thumb->createReflection(40,40,80,true,'#a4a4a4');
คำสั่งอื่นๆ ที่สามารถใช้ได้ดูได้ ที่นี่
หรือ ดาวน์โหลดจากที่นี่





Thank you! I would now go on this blog every day!
Pett
ขอบคุณมากเลยครับ ใช้งานง่ายดี ขอเก็บไปเล่นนะ อิอิ
The best information i have found exactly here. Keep going Thank you
Some of us even don’t realize the importance of this information. What a pity.