PHP Thumbnailer Demo

วันนี้ จะเอารูปมาย่อก่อน แล้วเวลาคลิกรูป ค่อยขึ้นรูปเต็มๆ
แต่เจอปัญหา ตรงที่รูปที่เราย่อ มันจะแตก ไม่สวย เลยลองเซิจ เรื่อยๆ มาเจอ blog นี้
ของเขาดีมากครับ ทำเป็น Thumbnail รูปเลยไม่แตก
วิธีใช้ก็ไม่ยากครับ
ขั้นแรกต้องโหลด
1.  Both PHP 5 & 4 Versions  <<สำหรับทั้ง 2 Version
2.  Download PHP 4 v2.0    << สำหรับ PHP 4
3.  Download PHP 5 v2.0    << สำหรับ PHP 5

แล้วเมื่อโหลดมาเราจะได้

อันนี้ผมใช้ PHP 5นะครับ

ไฟล์ที่จะใช้คือ
show_image.php
thumbnail.inc.php

เอาไปวาง เวลาเรียกใช้ต้องเรียกให้ตรง path ด้วยนะครับ

อย่างของผม จะเรียกใช้จาก ฐานจากข้อมูลก็

$sql_batt=”select * from tb_products where product_model=’$_GET[model]‘ AND brand_id=’$_GET[bid]‘ AND type_id=’$_GET[tid]‘ order by product_model asc”;
         $res_batt=mysql_db_query($dbname,$sql_batt);
         $num_batt=mysql_num_rows($res_batt);
         $i=0;
         while($i<$num_batt)
         {
         $r_batt=mysql_fetch_array($res_batt);
                               
                                if($r_batt[picture]==”")
        { ?>
                                <img src=”products_image/imagenot.jpg” width=”200″ height=”150″ />
                                <? }
        else
        { ?>
        <img src=”show_image.php?filename=products_image/<? echo”$r_batt[picture]“; ?>&width=200&height=150″ /> <? }  } ?>

 

หรือ จะมีวิธีการใช้แบบอื่นอีก เข้าไปดูได้ที่นี่ ครับ http://www.gen-x-design.com/projects/php-thumbnailer-class/

อันนี้วิธีใช้อย่างละเอียด http://www.gen-x-design.com/demos/thumbnailer/ 
 

Tags:

One Response to “PHP Thumbnailer Demo”

  1. wow gold Says:

    Excellent tips .I really appreciate all these points, and I agree completely…

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word